data = ((hwirq / 32) << 5) | ((hwirq % 32) & 0x1F)

Which doesn't seem to actually do anything?

It's not a no-op, because hwirq is signed.  It probably should be
unsigned, like most things.

You'll have to draw me a picture.

In C, signed division is round-towards-zero, while unsigned division
is round-towards-negative-infinity.  Suppose hwirq is -1, then
hwirq/32 is 0 and hwirq%32 is -1, so that the full expression above
will be 0x1f, not -1.  There is no such problem if hwirq would be
unsigned; the compiler can generate better code in that case.


Segher

_______________________________________________
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

Reply via email to