summaryrefslogtreecommitdiff
path: root/emulators/tme/patches/patch-bd
blob: 0fd68e606c8ab23eb009ade19ce8521ce7c2c577 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
$NetBSD: patch-bd,v 1.1 2007/03/17 13:44:20 tsutsui Exp $

--- generic/fb-xlat-auto.sh.orig	2005-05-15 04:02:20.000000000 +0900
+++ generic/fb-xlat-auto.sh	2007-03-11 18:06:24.000000000 +0900
@@ -458,11 +458,11 @@
       if (bits < 32) {						\\
         if (order == TME_ENDIAN_BIG) {				\\
           fifo |= (next >> bits);				\\
-          next <<= (32 - bits);					\\
+          next = (bits == 0) ? 0 : (next << (32 - bits));	\\
         }							\\
         else {							\\
           fifo |= (next << bits);				\\
-          next >>= (32 - bits);					\\
+          next = (bits == 0) ? 0 : (next >> (32 - bits));	\\
         }							\\
       }								\\
 								\\
@@ -506,11 +506,12 @@
     /* shift the FIFO: */					\\
     if (order == TME_ENDIAN_BIG) {				\\
       next |= (fifo >> bits);					\\
-      fifo <<= (32 - bits);					\\
+      fifo = (bits == 0) ? 0 : (fifo << (32 - bits));		\\
     }								\\
     else {							\\
       next |= (fifo << bits);					\\
       fifo >>= (32 - bits);					\\
+      fifo = (bits == 0) ? 0 : (fifo >> (32 - bits));		\\
     }								\\
     bits += (shift);						\\
 								\\