Learn to Code ยท zero-dependency ยท MIT

larzbits

Bitwise operations made visible.

Bit manipulation is where many learners hit a wall - the operators are terse and the effect invisible. larzbits does the operation and shows it lined up in binary, so 12 AND 10 = 8 becomes an obvious column-by-column picture. Pairs with larzbase.

larzscript pkg install bits
View on GitHub →Learn the stack

What you get

Try it

import "bits" as bits
print(bits.b_and(12, 10))
print(bits.b_or(12, 10))
print(bits.b_xor(12, 10))
print(bits.shift_left(1, 4))
print(bits.to_bits(-5, 8))
Output
8
14
6
16
11111011

Why it's in the Larz Stack

larzbits is a real Larzscript package (larzscript pkg install bits) - money-native, zero dependencies, the same language as the rest of the estate, not a separate Python runtime. It composes with the rest of the Larz Stack and the Larz framework.