異なるサイズの2つのビットフィールドを比較するためにビット単位の演算子(&
、|
など)を使用するとどうなりますか?
たとえば、0 1 1 0
と0 0 1 0 0 0 0 1
を比較すると、次のようになります。
0 1 1 0 0 0 0 0 The smaller one is extended with zeros and pushed to the
0 0 1 0 0 0 0 1 most-significant side.
または...
0 0 0 0 0 1 1 0 The smaller one is extended with zeros and pushed to the
0 0 1 0 0 0 0 1 least-significant side.
または...
0 1 1 0 The longer one is truncated from its least-significant side,
0 0 1 0 keeping its most significant side.
または...
0 1 1 0 The longer one is truncated from its most-significant side,
0 0 0 1 keeping its least-significant side.