qol_gleam/qol_bit_array

Values

pub fn from_int(x: Int) -> BitArray

Converts an integer into a bit array.

pub fn hash(data: BitArray) -> Int

Hash a bit array to an integer via FNV-1a algorithm.

Examples

assert hash(<<69>>) == 3_222_007_936

assert hash(<<"Hello, World!">>) == 1_525_479_220

assert hash(<<1, 2, 3, 4>>) == 1_463_068_797

assert hash(<<3, 9, 12>>) == 3_954_051_991

assert hash(<<3, 9, -12>>) == 330_189_455

pub fn to_int(bits: BitArray) -> Int

Converts a bit array to a integer.

Search Document