How do I check if an address is a multiple of 8 with bitwise operation in assembly Sparc?
Asked
Active
Viewed 740 times
1 Answers
1
Well in C you would need to do something like this:
is_multiple_of_8 = (addr & (8 - 1)) == 0;
So just convert this to asm, either by hand or by getting the compiler to help you (e.g. gcc -S
). It should really only be 2 or 3 instructions at most: you just need to AND the address with 7, then test for zero.

Paul R
- 208,748
- 37
- 389
- 560