Though this sort of bit-twiddling code can be hard to understand (which is why I agree with hv that your constants are more clearly expressed in binary or hex) it can also be lots of fun, and mind-bogglingly fast, as I learned a few years ago (in both Perl and C++) when implementing Conway's Game of Life.
References Added Later
PDL:
See Also
Updated: fixed broken links. Added more references. Adjusted attribution of Inline modules (thanks etj).
👁️🍾👍🦟
In reply to Re: Most Significant Set Bit (Bit Twiddling References)
by eyepopslikeamosquito
in thread Most Significant Set Bit
by coldr3ality
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |