Fix bit masking logic in 'dead bus' return

Sat, 17 Nov 2012 22:14:09 +0000

author
Philip Pemberton <philpem@philpem.me.uk>
date
Sat, 17 Nov 2012 22:14:09 +0000
changeset 114
36367ebd34e0
parent 113
d3bb6a6a04b7
child 115
da3d10af0711

Fix bit masking logic in 'dead bus' return

In some cases (e.g. 16bit reads) a bad 'idle bus' return may be provided.
Promote the '1' to unsigned long prior to left-shifting it.

src/memory.c file | annotate | diff | revisions
     1.1 --- a/src/memory.c	Sat Nov 17 21:28:48 2012 +0000
     1.2 +++ b/src/memory.c	Sat Nov 17 22:14:09 2012 +0000
     1.3 @@ -213,7 +213,7 @@
     1.4  			if (bits == 32)											\
     1.5  				return 0xFFFFFFFF;									\
     1.6  			else													\
     1.7 -				return (1 << bits)-1;								\
     1.8 +				return (1UL << bits)-1;								\
     1.9  		}															\
    1.10  	} while (0)
    1.11  /*}}}*/