Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

What are your favorite bit hacks?

Name: Anonymous 2023-06-27 1:10

Besides the obvious set/get/clear bit mask (e.g. byte |= (1 << bit_we_want_to_set)).

Mine would be determining if an integer is a power of 2. Instead of using some
unnecessary complex loop, we simply do:
x && ((x & (x - 1)) == 0);

Simple, but clever. If you are nub (most likely are), read up more on bit manipulation/twiddling/hack, etc.

Name: Anonymous 2023-06-28 0:17

>>2
You. Nub.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List