On Nov 3, 2005, at 20:49, Joshua Isom wrote:

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

Shifting anything by >= the bits of the int isn't portable nor specified.

    a = 24
    b = 16
    c = a >> b

and shifting a small number by 16 gives 0 - that's fine.

leo

Reply via email to