开发者

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

开发者 https://www.devze.com 2022-12-20 20:52 出处:网络
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.

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

精彩评论

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

关注公众号