Bit Twiddling

Bit Twiddling
Java

Population Count in Java

How do you count the bits in a 32 bit integer? Since this is possible in a single instruction, popcntd, which is exposed by an intrinsic method in Java and several other languages, this is a completely academic question. Nevertheless, however futile, deriving an efficient expression is instructive. A naive approach would be to check […]

Read More
Bit Twiddling

Is XOR Distributive over Addition?

Google search console has become a thing of mild interest to me since I moved my website and Google forgot about my content. Impressions – search terms that match your site but don’t lead to a click – are full of fascinating false positives. I looked at some of my impressions. These search terms are: […]

Read More