The code on top uses binary operators.
>>
is right shift operator. It shifts the bit in the number to the right (towards more significant bits).
So 11110000 >> 2 = 00111100
It's equivalent to division by powers of 2
$number >> $n
is the same as $number / pow(2,$n)
.
The &
is the "bitwise and" operator. It compares respective bits on both numbers, and sets in result those, that are 1
in both numbers.
11110000 & 01010101 = 01010000
By and'ing $number
with 63 (001111111
) you get the remainder of dividing $number
by 64 (aka the modulus), which is written $number % 64
.