[Verse 1] Down in the depths where the zeros and ones live Every bit has a story to give AND operation keeps what's common and true OR brings together me and you XOR flips when they're different inside NOT inverts every bit far and wide [Chorus] Shift left multiply, shift right divide AND for masks, OR to combine XOR to flip, NOT to invert the line Bits are dancing in perfect time Left shift doubles, right cuts in half Bitwise magic, do the math [Verse 2] When you need to check a single bit's state Use AND with one, don't hesitate To set a flag, OR with one will do Clear a bit, AND with zero's true Toggle switches with XOR's might Flip that bit from dark to light [Chorus] Shift left multiply, shift right divide AND for masks, OR to combine XOR to flip, NOT to invert the line Bits are dancing in perfect time Left shift doubles, right cuts in half Bitwise magic, do the math [Bridge] Rotation keeps the bits in play Circular motion, none drift away Left rotate brings the high bits low Right rotate makes the pattern flow Masks reveal what you want to see Filter data efficiently [Verse 3] Count the ones with Brian Kernighan's way AND with minus one, bits fade away Two's complement flips then adds one more Negative numbers at the core Sign extension fills the space Higher bits maintain their place [Chorus] Shift left multiply, shift right divide AND for masks, OR to combine XOR to flip, NOT to invert the line Bits are dancing in perfect time Left shift doubles, right cuts in half Bitwise magic, do the math [Outro] From the lowest level up we climb Every bit keeps perfect time Optimization starts below Where the binary rivers flow
← Function Calls and Calling Conventions | Performance and Timing Optimization →