Bit Twiddling Hacks


#1

For programmers (assuming knowledge of C and two-complement representation), I bumped into a nice overview of tricks, that may be inspiring:
http://graphics.stanford.edu/~seander/bithacks.html


#2

ooh, I like some of those... especially the ones that avoid branching.
(though, id say when used, probably deserve a comment, as some are far from obvious :slight_smile: )


#3

Avoiding branching is not necessarily significant, the Cortex M4 can execute many instructions conditionally
http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0489e/Cihjedjg.html


#4

Cool, just what I need, I think!

a|x