- Bitwise AND (&)
- Bitwise OR (|)
- Bitwise XOR (^)
- Left shift (<<)
- Right shift (>>)

- Flags and bit masks (packing multiple boolean flags into one integer)
- Performance-sensitive arithmetic (shift-based multiply/divide by powers of two)
- Low-level protocol parsing, embedded and systems programming
Bitwise AND (&)
Bitwise AND compares each bit of two operands and yields 1 only when both corresponding bits are 1; otherwise the result bit is 0.
Example: 12 & 25

Note: In Go, ^ is also the unary bitwise NOT (complement) when used with a single operand (for example
^x flips all bits of x). In the examples above ^ is used as a binary XOR operator.Be careful with signed integers and right shifts: the fill behavior for the leftmost bits (sign extension vs. zero fill) depends on the type and implementation. For predictable behavior, use unsigned integers (
uint, uint32, uint64) when performing bit-level shifts.- The Go Programming Language Specification — Operators
- Kubernetes Documentation (for system-level use cases)
- Binary and Bitwise Operations — Wikipedia