c trick

27/01/2010

I love indexing constant strings, I’m sad like that.

for example,

char c=”0123456789abcdef”[b&15];

converts the low nybble of byte b into its hex character.

oldie, but goldie.


Tags: