bitwise_binary v0.3.0 Bitwise.Binary

Simple module to extend bitwise operations to full binaries (and not just integers)

Link to this section Summary

Functions

Calculates the bitwise AND of its arguments.

Calculates the result of an arithmetic left shift.

Calculates the result of an arithmetic right shift.

Calculates the bitwise XOR of its arguments.

Calculates the bitwise AND of its arguments.

Calculates the bitwise NOT of its arguments.

Calculates the bitwise OR of its arguments.

Calculates the result of a binary left rotation

Calculates the result of a binary right rotation

Calculates the result of an arithmetic left shift.

Calculates the result of an arithmetic right shift.

Calculates the bitwise XOR of its arguments.

Calculates the bitwise OR of its arguments.

Calculates the bitwise NOT of its arguments.

Link to this section Functions

Calculates the bitwise AND of its arguments.

iex> <<9, 0>> &&& <<3, 0>>
<<1, 0>>

Calculates the result of an arithmetic left shift.

iex> <<1, 0>> <<< 2
<<4, 0>>

Calculates the result of an arithmetic right shift.

iex> <<4, 0>> >>> 2
<<1, 0>>

Calculates the bitwise XOR of its arguments.

iex> <<9, 0>> ^^^ <<3, 0>>
<<10, 0>>
Link to this function

band(left, right)

Calculates the bitwise AND of its arguments.

iex> band(<<9, 0>>, <<3, 0>>)
<<1, 0>>

Calculates the bitwise NOT of its arguments.

iex> bnot(<<2, 0>>)
<<253, 255>>
Link to this function

bor(left, right)

Calculates the bitwise OR of its arguments.

iex> bor(<<9, 0>>, <<3, 0>>)
<<11, 0>>
Link to this function

brl(left, right)

Calculates the result of a binary left rotation

iex> brl(<<255, 0>>, 1)
<<254, 1>>
Link to this function

brr(left, right)

Calculates the result of a binary right rotation

iex> brr(<<255, 0>>, 1)
<<127, 128>>
Link to this function

bsl(left, right)

Calculates the result of an arithmetic left shift.

iex> <<1, 0>> <<< 2
<<4, 0>>
Link to this function

bsr(left, right)

Calculates the result of an arithmetic right shift.

iex> <<4, 0>> >>> 2
<<1, 0>>
Link to this function

bxor(left, right)

Calculates the bitwise XOR of its arguments.

iex> <<9, 0>> ^^^ <<3, 0>>
<<10, 0>>

Calculates the bitwise OR of its arguments.

iex> <<9, 0>> ||| <<3, 0>>
<<11, 0>>

Calculates the bitwise NOT of its arguments.

iex> ~~~<<2, 0>>
<<253, 255>>