Pfx.padl
You're seeing just the function
padl
, go back to Pfx module for more information.
Specs
Pads the bits in pfx
on the left to its full length using 0
-bits.
Examples
iex> padl("1.2.0.0/16")
"0.0.1.2"
iex> padl({{1, 2, 0, 0}, 16})
{{0, 0, 1, 2}, 32}
iex> padl(%Pfx{bits: <<1, 2>>, maxlen: 32})
%Pfx{bits: <<0, 0, 1, 2>>, maxlen: 32}
Specs
Left pad the pfx.bits
to its full length using either 0
or 1
-bits.
Examples
iex> padl("1.2.0.0/16", 1)
"255.255.1.2"
iex> padl({{1, 2, 0, 0}, 16}, 1)
{{255, 255, 1, 2}, 32}
iex> padl(%Pfx{bits: <<1, 2>>, maxlen: 32}, 1)
%Pfx{bits: <<255, 255, 1, 2>>, maxlen: 32}
Specs
padl(prefix(), 0 | 1, non_neg_integer()) :: prefix()
Pads the bits in pfx
on the Left with n
bits of either 0
or 1
's.
Examples
iex> padl("255.255.0.0/16", 0, 16)
"0.0.255.255"
iex> padl("255.255.0.0/16", 1, 16)
"255.255.255.255"
iex> padl({{255, 255, 0, 0}, 16}, 0, 16)
{{0, 0, 255, 255}, 32}
iex> padl(%Pfx{bits: <<255, 255>>, maxlen: 32}, 0, 16)
%Pfx{bits: <<0, 0, 255, 255>>, maxlen: 32}