http://www.hakmem.org/#item169
It seems that look up tables are still faster when memory allows it though (http://www.dalkescientific.com/writings/diary/archive/2008/0...)
http://www.hakmem.org/#item169