$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);						\\
 								\\
