Pfx.brot

You're seeing just the function brot, go back to Pfx module for more information.

Specs

brot(prefix(), integer()) :: prefix()

Rotate the pfx.bits by n positions.

Positive n rotates right, negative rotates left.

Note that the length of the resulting pfx.bits stays the same.

Examples

iex> brot(%Pfx{bits: <<1, 2, 3, 4>>, maxlen: 32}, 8)
%Pfx{bits: <<4, 1, 2, 3>>, maxlen: 32}

iex> new(<<1, 2, 3, 4>>, 32) |> brot(-8)
%Pfx{bits: <<2, 3, 4, 1>>, maxlen: 32}

iex> brot("1.2.3.4", 8)
"4.1.2.3"

iex> brot({1, 2, 3, 4}, 8)
{4, 1, 2, 3}

iex> brot({{1, 2, 3, 4}, 32}, -8)
{{2, 3, 4, 1}, 32}

# remember, its <<1, 2>> that gets rotated (!)
iex> brot({{1, 2, 3, 4}, 16}, 8)
{{2, 1, 0, 0}, 16}