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
Bit Twiddling Hacks
johannes
#1
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 )
johannes
#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