News for hackers. Stuff that matters.
Re:Bit Twiddling Hacks by adrianN on Saturday May 21, 2011 @02:02AM (#2570347)
Nowadays things like these should only be interesting to compiler writers.
Re:Bit Twiddling Hacks by Xk on Saturday May 21, 2011 @02:40AM (#2570385)
Believe it or not, there are still programs that require blazingly fast bit operations. I used like ten different bit hacks for a game engine I wrote which uses bitboards[1].

[1] http://en.wikipedia.org/wiki/Bitboard

Re:Bit Twiddling Hacks by akdubya on Saturday May 21, 2011 @04:05AM (#2570470)
Bitwise operations pop up fairly often in advanced data structures (Hash Array Mapped Tries, Bloom Filters, etc). The big advantage in my view is being able to perform complex, data-intensive tasks in otherwise limited environments (e.g., mobile devices).
Re:Bit Twiddling Hacks by cultureulterior on Saturday May 21, 2011 @05:18AM (#2570550)
There are algorithms that use bits just like there are algorithms that use trees. You wouldn't expect your compiler to write your algorithms for you, would you.

Just recently, I've used the bitboards representation for cellular automata (which lets you compute 64 cells at the same time by doing about 100 non-branching integer instructions). I have difficulty seeing a compiler that can recognize that algorithmic optimization.

Re:Bit Twiddling Hacks by andreasvc on Saturday May 21, 2011 @08:12AM (#2570731)
I took him to mean that compiler writers should provide these bit operations in the most efficient manner on the current platform, e.g. __builtin_ctzl instead of directly using assembly or using arithmetical solutions.
Re:Bit Twiddling Hacks by gaius on Saturday May 21, 2011 @03:10AM (#2570407)
It's no surprise this is hosted on graphics.stanford.edu.
Re:Bit Twiddling Hacks by natemartin on Saturday May 21, 2011 @02:28AM (#2570374)
Might still be useful for some embedded applications.