1

How do I check if an address is a multiple of 8 with bitwise operation in assembly Sparc?

Matt
  • 22,721
  • 17
  • 71
  • 112
DogDog
  • 4,820
  • 12
  • 44
  • 66

1 Answers1

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