Exiffer.Binary (exiffer v0.2.3)

Documentation for Exiffer.Binary.

Link to this section Summary

Functions

Force big endian byte order

Convert big endian to the currently selected byte order

Convert big-endian binary bytes to an integer.

Convert a 16-bit integer to big-endian binary bytes.

Convert a 16-bit integer to binary bytes in current byte order.

Convert a 16-bit integer to little-endian binary bytes.

Convert a 32-bit integer to big-endian binary bytes.

Convert a 32-bit integer to binary bytes in current byte order.

Convert a 32-bit integer to little-endian binary bytes.

Convert little-endian binary bytes to integer.

Reverse the given binary bytes

Convert binary bytes to decimal based on endianness.

When given 8 bytes, returns a single {numerator, denominator} tuple. When given multiples of 8 bytes, returns a list of those tuples.

When given 8 bytes, returns a single {numerator, denominator} tuple. When given multiples of 8 bytes, returns a list of those tuples.

Link to this section Types

@type rational() :: {non_neg_integer(), non_neg_integer()}
Link to this type

signed_rational()

@type signed_rational() :: {integer(), integer()}

Link to this section Functions

Link to this function

big_endian(binary)

@spec big_endian(binary()) :: binary()

Force big endian byte order

Link to this function

big_endian_to_current(binary)

@spec big_endian_to_current(binary()) :: binary()

Convert big endian to the currently selected byte order

Link to this function

big_endian_to_integer(arg)

@spec big_endian_to_integer(binary()) :: non_neg_integer()

Convert big-endian binary bytes to an integer.

Link to this function

big_endian_to_signed(arg)

@spec big_endian_to_signed(<<_::32>>) :: integer()
@spec byte_order() :: :big | :little
Link to this function

int16u_to_big_endian(integer)

@spec int16u_to_big_endian(integer()) :: <<_::16>>

Convert a 16-bit integer to big-endian binary bytes.

Link to this function

int16u_to_current(integer)

@spec int16u_to_current(integer()) :: <<_::16>>

Convert a 16-bit integer to binary bytes in current byte order.

Link to this function

int16u_to_little_endian(integer)

@spec int16u_to_little_endian(integer()) :: <<_::16>>

Convert a 16-bit integer to little-endian binary bytes.

Link to this function

int32s_to_big_endian(integer)

@spec int32s_to_big_endian(integer()) :: <<_::32>>
Link to this function

int32s_to_current(integer)

@spec int32s_to_current(integer()) :: <<_::32>>
Link to this function

int32s_to_little_endian(integer)

@spec int32s_to_little_endian(integer()) :: <<_::32>>
Link to this function

int32u_to_big_endian(integer)

@spec int32u_to_big_endian(integer()) :: <<_::32>>

Convert a 32-bit integer to big-endian binary bytes.

Link to this function

int32u_to_current(integer)

@spec int32u_to_current(integer()) :: <<_::32>>

Convert a 32-bit integer to binary bytes in current byte order.

Link to this function

int32u_to_little_endian(integer)

@spec int32u_to_little_endian(integer()) :: <<_::32>>

Convert a 32-bit integer to little-endian binary bytes.

Link to this function

little_endian_to_integer(arg)

@spec little_endian_to_integer(binary()) :: non_neg_integer()

Convert little-endian binary bytes to integer.

Link to this function

little_endian_to_signed(arg)

@spec little_endian_to_signed(<<_::32>>) :: integer()
Link to this function

optionally_create_ets_table()

@spec optionally_create_ets_table() :: :ok
Link to this function

rational_to_current(rationals)

@spec rational_to_current(rational() | [rational()]) :: binary() | [binary()]
@spec rational_to_current(signed_rational() | [signed_rational()]) ::
  binary() | [binary()]
Link to this function

reverse(binary)

@spec reverse(binary()) :: binary()

Reverse the given binary bytes

Link to this function

set_byte_order(byte_order)

@spec set_byte_order(:big | :little) :: true
Link to this function

signed_rational_to_current(rationals)

Link to this function

to_integer(binary)

@spec to_integer(binary()) :: non_neg_integer()

Convert binary bytes to decimal based on endianness.

Link to this function

to_rational(arg)

@spec to_rational(binary()) :: rational() | [rational()]

When given 8 bytes, returns a single {numerator, denominator} tuple. When given multiples of 8 bytes, returns a list of those tuples.

@spec to_signed(<<_::32>>) :: integer()
Link to this function

to_signed_rational(arg)

@spec to_signed_rational(binary()) :: signed_rational() | [signed_rational()]

When given 8 bytes, returns a single {numerator, denominator} tuple. When given multiples of 8 bytes, returns a list of those tuples.