简体   繁体   中英

C++ Bitwise Operator Understanding Code

a &= ~(1 << 10);

上面的代码是否真的意味着:

a &= (0 << 10);

~ is bitwise inversion (take every 1 and turn it into 0, every 0 into 1), so if you have x = 0b0100 (assume 4 bit integers for a second), then ~x == 0b1011 . << is "shift this to the left", so '(1 << 2) == 0b0100`.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM