Determining number of like-valued bits in word