Why does octet mod 8 have to be 0? Don't you like /23
subnets? You don't check to make sure that the octets
consists of contiguous one bits followed by contiguous zeros -
you can do that by checking to see if:
(~$octet & -$octet & 255) == 0
Update:To clarify, the $net business tracks
continuous one bits between octets, but not within a single
octet.