Do you know what /= and >> operators do?
Opps.. It seems you have "|=" (xor) not "/="
Since this is playing with the bit patterns of the function argument I would suggest that you convert some trial argument to binary and trace this. Also I would be interested in what you think the closest power of 2 means and how that compares with what this code produces.