Media Molecule PMoly

c trick

2010January 27th

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.


Posted by: Alex

Categories: Code
Tags: c tips

Comments From people on the internets