Golang operators

From wikinotes

Logical

&&  // and
||  // or
!   // not

Arithmetic

Go requires that all variables involved in arithmetic are the same type.
(ex. uint8 + unit16 would fail to compile)

1 + 1 // addition
1 - 1 // subtraction
1 * 1 // multiplication
1 / 1 // division
1 % 1 // modulus

Bitwise Operators

0b1111 &  0b0101 == 0b0101 // bitmask          (bitwise and)
0b0111 |  0b1100 == 0b1111 // set-bit          (bitwise or)
0b0011 ^  0b1010 == 0b1001 // toggle-bit       (bitwise xor)
0b1100 &^ 0b0110 == 0b0001 // inverted bitmask (bitise and-not)

0b0011 << 0b0001 == 0b0110 // bit-shift left
0b0110 >> 0b0001 == 0b0011 // bit-shift right