1

I'm interested to find x % y where x is long and y is always 8.

I've the following implementation:

int result = (int) (x & 7);

I observed the performance (getting execution time for millions of operations with random inputs) of the above code over the traditional "%" operator and I didn't see any improvement.

'&' should runs faster than '%' - Right?

User_67128
  • 1,230
  • 8
  • 21

0 Answers0