Exercise 2-9

xiaoxiao2021-03-06  51

When evaluating the second boss, the expression X & = (x-1) can delete a binary bit of the rightmost value of 1 in X. Please explain the truth of this. Use this method to rewrite the Bitcount function to speed up Perform speed.

Original BitCount function ginseng P40

/ ************************************************** ******* / int bitcount (unsigned x) {INT B; for (b = 0; x! = 0; x & = (x-1), b ); return b;}

转载请注明原文地址:https://www.9cbs.com/read-117056.html

New Post(0)