Here is a small analysis (versions of the "readable form"):
usnigned int nx = ~x;
It seems that the algorithm is looking for the first 2 (starting with LSB) consecutive bits 0 in the variable x . If they are not, then the result is 0. If they are found, say, in position PZ , then the result will contain two bits: PZ and PZ+1 .
ruslik
source share