blops/ints

Bitwise integer operations.

Includes

All operations have 32-bit and 64-bit signed and unsigned variants. The standard library has some of these, but they are not exhaustive or size-specific.

Shift operations all behave big-endianly (left doubles, right halves) regardless of the underlying system’s native endianness. You might run into wonky behavior using some of the 64-bit variants with Javascript.

Values

pub fn i32_band(a: Int, b: Int) -> Int

32-bit signed-integer bitwise and

pub fn i32_beq(a: Int, b: Int) -> Int

32-bit signed integer bitwise equal

pub fn i32_bimpl(a: Int, b: Int) -> Int

32-bit signed integer bitwise implication

pub fn i32_bneq(a: Int, b: Int) -> Int

32-bit signed integer bitwise not-equal (xor)

pub fn i32_bnimpl(a: Int, b: Int) -> Int

32-bit signed integer bitwise not-implies

pub fn i32_bnor(a: Int, b: Int) -> Int

32-bit signed integer bitwise not-or

pub fn i32_bnot(a: Int) -> Int

Signed 32-bit bitwise negation

pub fn i32_bnrevi(a: Int, b: Int) -> Int

32-bit signed integer bitwise not-reverse-implies

pub fn i32_bor(a: Int, b: Int) -> Int

32-bit signed integer bitwise or

pub fn i32_brevi(a: Int, b: Int) -> Int

32-bit signed integer bitwise reverse implication (because, only-if)

pub fn i32_nand(a: Int, b: Int) -> Int

32-bit signed integer bitwise not-and (nand)

pub fn i32_shl(a: Int, dist: Int) -> Int
pub fn i32_shr(a: Int, dist: Int) -> Int
pub fn i64_band(a: Int, b: Int) -> Int
pub fn i64_beq(a: Int, b: Int) -> Int
pub fn i64_bimpl(a: Int, b: Int) -> Int
pub fn i64_bneq(a: Int, b: Int) -> Int
pub fn i64_bnimpl(a: Int, b: Int) -> Int
pub fn i64_bnor(a: Int, b: Int) -> Int
pub fn i64_bnot(a: Int) -> Int

Signed 64-bit bitwise negation

pub fn i64_bnrevi(a: Int, b: Int) -> Int
pub fn i64_bor(a: Int, b: Int) -> Int
pub fn i64_brevi(a: Int, b: Int) -> Int
pub fn i64_nand(a: Int, b: Int) -> Int
pub fn i64_shl(a: Int, dist: Int) -> Int
pub fn i64_shr(a: Int, dist: Int) -> Int
pub fn u32_band(a: Int, b: Int) -> Int

32-bit unsigned integer bitwise and

pub fn u32_beq(a: Int, b: Int) -> Int

32-bit unsigned integer bitwise equal

pub fn u32_bimpl(a: Int, b: Int) -> Int

32-bit unsigned integer bitwise implication (if-then)

pub fn u32_bneq(a: Int, b: Int) -> Int

32-bit unsigned integer bitwise not-equal (xor)

pub fn u32_bnimpl(a: Int, b: Int) -> Int

32-bit unsigned integer bitwise not-implies

pub fn u32_bnor(a: Int, b: Int) -> Int

32-bit unsigned integer bitwise nor

pub fn u32_bnot(a: Int) -> Int

Unsigned 32-bit bitwise negation

pub fn u32_bnrevi(a: Int, b: Int) -> Int

32-bit unsigned integer bitwise not-reverse-implies

pub fn u32_bor(a: Int, b: Int) -> Int

32-bit unsigned integer bitwise or

pub fn u32_brevi(a: Int, b: Int) -> Int

32-bit unsigned integer bitwise reverse implication (because, only-if)

pub fn u32_nand(a: Int, b: Int) -> Int

32-bit unsigned integer not-and (nand)

pub fn u32_shl(a: Int, dist: Int) -> Int
pub fn u32_shr(a: Int, dist: Int) -> Int
pub fn u64_band(a: Int, b: Int) -> Int
pub fn u64_beq(a: Int, b: Int) -> Int
pub fn u64_bimpl(a: Int, b: Int) -> Int
pub fn u64_bnand(a: Int, b: Int) -> Int
pub fn u64_bneq(a: Int, b: Int) -> Int
pub fn u64_bnimpl(a: Int, b: Int) -> Int
pub fn u64_bnor(a: Int, b: Int) -> Int
pub fn u64_bnot(a: Int) -> Int

Unsigned 64-bit bitwise negation

pub fn u64_bnrevi(a: Int, b: Int) -> Int
pub fn u64_bor(a: Int, b: Int) -> Int
pub fn u64_brevi(a: Int, b: Int) -> Int
pub fn u64_shl(a: Int, dist: Int) -> Int
pub fn u64_shr(a: Int, dist: Int) -> Int
✨ Search Document