Chapter 5 | Bit Manipulation
先清零再或?
不会。
穷举
5.4 Explain what the following code does: ((n & (n-1)) == 0).
判断是否为2的整数次幂。
傻瓜方法就是一个一个比,好一点就是异或?
原解挺妙。0x5555和移位或来配合。
原解感觉略弱,或许是我没有理解清楚题意。
Chapter 5 | Bit Manipulation
先清零再或?
不会。
穷举
5.4 Explain what the following code does: ((n & (n-1)) == 0).
判断是否为2的整数次幂。
傻瓜方法就是一个一个比,好一点就是异或?
原解挺妙。0x5555和移位或来配合。
原解感觉略弱,或许是我没有理解清楚题意。