bit_array


bit_array(bit1, @rest...)
      

Return a new bit-array with bit1, ... as elements. Each of the values bit1, ... should be either 0 or 1. All values other than 0 will turn the corresponding bit on.

A bit-array is a compact array of bit values. Bit-array literals have the prefix #b. For example, this is a bit-array literal with 4 bits: #b[1, 0, 1, 1].

Examples:


let b = bit_array(1, 0, 0, 1, 1)
b          
// #b[1, 0, 0, 1, 1]
bit_array_is_set(b, 0)
// true
bit_array_is_set(b, 1)
// false

bit_array_set(b, 1)
b
// #b[1, 1, 0, 1, 1]
bit_array_clear(b, 3)
b
// #b[1, 1, 0, 0, 1]
      

Also see:

make_bit_array
is_bit_array


Core Module Index | Contents