a = Bitset.new(7)
b = ~Bitset.new(7)
a.hamming(b) #=> 64
The problem is that internally the representation is always some number of 64-bit integers, and so unless we explicitly mask out the bits that exist above the actual content bits, it's easy for them to affect operations.