Changed logDistance to return KEY_BITS - bits in common instead of just bits in common