逻辑运算与位移运算
異或運(yùn)算
True ⊕ False = True
False ⊕ True = True
False ⊕ False = False
True ⊕ True = False
同或運(yùn)算
True ⊙ False = False
False ⊙ True = False
False ⊙ False = Ture
True ⊙ True = Ture
或運(yùn)算
True ?|| False = True
False || True = True
False || False = False
True ?|| True = True
與運(yùn)算
True ?&& False = False
False && True = False
False && False = False
True ?&& True = True
非運(yùn)算
┐True = False
┐False = True
位移運(yùn)算
左移:2<<2 = 8
右移:8>>2 = 2
右移一位相當(dāng)于除2,右移n位相當(dāng)于除以2的n次方
在數(shù)字沒有溢出的前提下,對于正數(shù)和負(fù)數(shù),左移一位都相當(dāng)于乘以2的1次方,左移n位就相當(dāng)于乘以2的n次方。
True ⊕ False = True
False ⊕ True = True
False ⊕ False = False
True ⊕ True = False
同或運(yùn)算
True ⊙ False = False
False ⊙ True = False
False ⊙ False = Ture
True ⊙ True = Ture
或運(yùn)算
True ?|| False = True
False || True = True
False || False = False
True ?|| True = True
與運(yùn)算
True ?&& False = False
False && True = False
False && False = False
True ?&& True = True
非運(yùn)算
┐True = False
┐False = True
位移運(yùn)算
左移:2<<2 = 8
右移:8>>2 = 2
右移一位相當(dāng)于除2,右移n位相當(dāng)于除以2的n次方
在數(shù)字沒有溢出的前提下,對于正數(shù)和負(fù)數(shù),左移一位都相當(dāng)于乘以2的1次方,左移n位就相當(dāng)于乘以2的n次方。
總結(jié)
- 上一篇: windows各个原版系统下载集锦 MS
- 下一篇: 服务器术语大全