Skip to content

aivi.bits

Compiler-backed bitwise integer intrinsics.

This is a low-level module for bitwise work on Int values.

aivi
use aivi.bits (
    and
    or
    xor
    not
    shiftLeft
    shiftRight
    shiftRightUnsigned
)

Exports

NameType
andInt -> Int -> Int
orInt -> Int -> Int
xorInt -> Int -> Int
notInt -> Int
shiftLeftInt -> Int -> Int
shiftRightInt -> Int -> Int
shiftRightUnsignedInt -> Int -> Int
aivi
use aivi.bits (
    and
    or
    xor
    not as bitNot
    shiftLeft
    shiftRight
)

value masked : Int = and 15 10
value combined : Int = or 5 10
value toggled : Int = xor 15 3
value inverted : Int = bitNot 0
value widened : Int = shiftLeft 1 4
value narrowed : Int = shiftRight 32 2

(c) 2026 by Andreas Herd