optimize the bit operation while keys len diff