Lichen

Annotated tests/bitwise.py

843:d305986d05c8
2018-07-05 Paul Boddie Employed sets for attributes and providers referenced by accesses. This causes various attributes to be identified definitively in the access plans and instruction sequences.
paul@798 1
def encode(value):
paul@798 2
    return ((value & 8) << 4) | ((value & 4) << 3) | ((value & 2) << 2) | ((value & 1) << 1)
paul@798 3
paul@798 4
print encode(15)    # 170
paul@798 5
print encode(8)     # 128
paul@798 6
print encode(2)     # 8
paul@798 7
print encode(0)     # 0