开发者

Ideas for making a function for counting number of zero's in a bit string in C?

Can I make a function int bitParity(int x) that returns 1 开发者_运维知识库if x contains an odd number of 0's using only these operators? ! ~ & ^ | + << >>


Hey, it was exactly three clicks. google -> 1.st result - wiki/Parity_bit -> external link -> http://graphics.stanford.edu/~seander/bithacks.html#ParityNaive

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜