qol_gleam/qol_bit_array

Values

pub fn from_int(x: Int) -> BitArray

Converts a integer into a bit array.

pub fn hash(data: BitArray) -> Int

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

Examples

hash(<<69>>)
// -> 3_222_007_936

hash(<<"Hello, World!">>)
// -> 1_525_479_220

hash(<<1, 2, 3, 4>>)
// -> 1_463_068_797

hash(<<3, 9, 12>>)
// -> 3_954_051_991

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

pub fn to_int(bits: BitArray) -> Int

Converts a bit array to a integer.

Search Document