Unix Tell All Book From Kernighan Hits the Shelves

When you think of the Unix and C revolution that grew out of Bell Labs, there are a few famous names. Dennis Ritchie, Ken Thompson, and Brian Kernighan come to mind. After all, the K in both K&R C and in AWK stand for Kernighan. While Kernighan is no stranger …read more

Continue reading Unix Tell All Book From Kernighan Hits the Shelves

Abusing A CPU’s Adders To Optimize Bit Counting

If you like nitpicking around C code and generated assembly language — and we’ll admit that we do — you shouldn’t miss [Scaramanga’s] analysis of what’s known as Kernighan’s trick. If you haven’t heard of the trick, it’s a pretty efficient way of counting bits.

Like the Wheatstone bridge and …read more

Continue reading Abusing A CPU’s Adders To Optimize Bit Counting