ビット演算

Dephiだとビット演算の代わりに集合型を使うことが多い。だから、たまにWindowsAPIなどでビット演算が必要になったとき、忘れてしまっているがあるので書いておく。

and

1 and 1 = 1
1 and 0 = 0
0 and 1 = 0
0 and 0 = 0

or

1 or 1 = 1
1 or 0 = 1
0 or 1 = 1
0 or 0 = 0

xor

1 xor 1 = 0
1 xor 0 = 1
0 xor 1 = 1
0 xor 0 = 0

not

not 1 = 0
not 0 = 1

Tips

ブログ

リンク