Bit Hacking (with Go code)

In order to be a successful programmer, one needs to understand how to manipulate bits, including individual bits within a register. Programming with integers can be done using 8-bit, 16-bit, 32-bit and 64-bit integers. Go has several important binary operators that are used to manipulate bits, including bitwise AND, OR, XOR and AND NOT, as well as the symbol ^ which is used to flip all bits in a word when used as an unary operation. Efficient and safe operations over integers can also be achieved by using SWAR (SIMD within a register) techniques. Finally, we can rotate and reverse bits in order to compare byte values.

https://lemire.me/blog/2023/02/07/bit-hacking-with-go-code/

To top