码迷,mamicode.com
首页 > 其他好文 > 详细

Bit Manipulation

时间:2016-01-09 10:55:29      阅读:114      评论:0      收藏:0      [点我收藏+]

标签:

------------------------

作用于bit的逻辑运算符:

&   // and

|  // or

^   // xor

~   // not

作用于变量时,bitwise

5&3=1 // 101&11=1

 

------------------------

<< //左移

>> // 右移

左移右移不会改变变量本身的值

int a=5; //101

cout<<(a<<1)<<endl; //10

cout<<a<<endl; //5

    

Bit Manipulation

标签:

原文地址:http://www.cnblogs.com/XingyingLiu/p/5115548.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!