0x1 is just the hexadecimal notation of number
& some integer with
0x1 to get its least significant (rightmost) bit. You write
0x1 instead of
1 when using a bit mask because it's easier to convert from base 16 than from base 10 to base 2.
For the second question, what
func PrefixLen does is finding the number of consecutive zeroes on the beginning of
count. The outer loop does one byte each time, and the inner loop deals with separate bits: when j=0 it shifts 7 to the right thus getting the first bit from left, when j=1 it shifts 6 getting the second bit, and so on. When a bit of
1 is encountered it returns the count of bits already checked.