Bit Twiddling Hacks
Sean Eron Anderson (Reddit, Hacker News) has a long list of code snippets:
As of May 5, 2005, all the code has been tested thoroughly. Thousands of people have read it. Moreover, Professor Randal Bryant, the Dean of Computer Science at Carnegie Mellon University, has personally tested almost everything with his Uclid code verification system. What he hasn’t tested, I have checked against all possible inputs on a 32-bit machine.
It sounds like they’re correct, but that since the list dates to 2005 the performance characteristics may have changed.