I was trying to use bit shifting for division by multiples of two, but
if the shift amount is a multiple of the int size, it seems to fail to
shift the bits. Here's some example code demonstrating it.
.sub _main @MAIN
.local int a, b, c
print "a\tb\tc\n"
a = 24
b = 32
c = a >> b
print a
print "\t"
print b
print "\t"
print c
print "\n"
a = 24
b = 16
c = a >> b
print a
print "\t"
print b
print "\t"
print c
print "\n"
c >>= b
print a
print "\t"
print b
print "\t"
print c
print "\n"
.end
Here's the output I get.
a b c
24 32 24
24 16 0
24 16 0
If I change b to 64, 96, or any multiple of 32, a remains unchanged.
The size of int does make the difference. It works with my darwin
installation with 32 but not my freebsd installation. hugefloatvalsize
is 12 for darwin but 8 for freebsd. Gcc 3.4 for darwin, 3.3 for
freebsd. Other than differences with compile environments(ppc darwin
and x86 freebsd differences), it's a fairly identical installation.
It's getting me somewhat confused.