NumEx v0.1.0 Binary View Source

A module to perform binary operations on enumerables

Link to this section Summary

Functions

Takes an Integer, returns its binary representation

Takes an two enumerables, performs bitwise_and on them, element_wise

Takes an two enumerables, performs bitwise_or on them, element_wise

Takes an two enumerables, performs bitwise_or on them, element_wise

Takes an enumerable, performs bitwise_not on its elements

Takes two values, performs arithmetic left shift on them

Takes two values, performs arithmetic right shift on them

Link to this section Functions

Link to this function binary_repr(x) View Source
binary_repr(integer()) :: integer()

Takes an Integer, returns its binary representation.

Examples

iex>Binary.binary_repr(5)
101
Link to this function bitwise_and(arr1, arr2) View Source
bitwise_and(list(), list()) :: list()

Takes an two enumerables, performs bitwise_and on them, element_wise.

Examples

iex> Binary.bitwise_and([2,3,4],[4,5,6])
[0, 1, 4]
Link to this function bitwise_or(arr1, arr2) View Source
bitwise_or(list(), list()) :: list()

Takes an two enumerables, performs bitwise_or on them, element_wise.

Examples

iex> Binary.bitwise_or([2,3,4],[4,5,6])
[6, 7, 6]
Link to this function bitwise_xor(arr1, arr2) View Source
bitwise_xor(list(), list()) :: list()

Takes an two enumerables, performs bitwise_or on them, element_wise.

Examples

iex> Binary.bitwise_xor([2,3,4],[4,5,6])
[6, 6, 2]
Link to this function invert(arr1) View Source
invert(list()) :: list()

Takes an enumerable, performs bitwise_not on its elements.

Examples

iex>  Binary.invert([32, 5, 1])
[-33, -6, -2]
Link to this function left_shift(x, y) View Source
left_shift(integer(), list()) :: list()

Takes two values, performs arithmetic left shift on them.

Examples

iex> Binary.left_shift(2, [4,5,6])
[32, 64, 128]
Link to this function right_shift(x, y) View Source
right_shift(integer(), list()) :: list()

Takes two values, performs arithmetic right shift on them.

Examples

iex> Binary.right_shift(32,[4,5,6])
[2, 1, 0]