BitFlagger (bit_flagger v0.1.0) View Source

A set of functions that manipulate bit flags.

Link to this section Summary

Functions

Turns off the flag at a specified index.

Checks if the flag is turned off at a specified index.

Turns on the flag at a specified index.

Checks if the flag is turned on at a specified index.

Converts an integer to a list of boolean values.

Link to this section Functions

Specs

Turns off the flag at a specified index.

Examples

iex> off(0b1111, 2)
0b1011

Specs

Checks if the flag is turned off at a specified index.

Examples

iex> off?(0b0001, 1)
true

iex> off?(0b0001, 0)
false

Specs

Turns on the flag at a specified index.

Examples

iex> on(0b0000, 2)
0b0100

Specs

Checks if the flag is turned on at a specified index.

Examples

iex> on?(0b0010, 1)
true

iex> on?(0b0010, 3)
false

Specs

Converts an integer to a list of boolean values.

Examples

iex> parse(0b1010, 4)
[false, true, false, true]