Skip to content

Comment on When static makes your C code 10 times faster

Comments

Wouldn’t making that const or using #define be a bit cleaner?

Honestly if I as the programmer knew that I was really trying to select bits from a number I’d just use a binary and directly. In that specific situation I think the intent is more clear that way. Like:

//select the bottom 8 bits

unsigned bottom8 = val & 0xff;

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.