Pfx.bor
You're seeing just the function
bor
, go back to Pfx module for more information.
Specs
Returns a bitwise OR of pfx1
and pfx2
.
Both prefixes must have the same maxlen
. The result will have the same
number of bits as its first argument.
Examples
iex> bor("1.2.3.4", "0.0.255.0")
"1.2.255.4"
iex> bor({1, 2, 3, 4}, "0.0.255.0")
{1, 2, 255, 4}
iex> bor({{1, 2, 3, 4}, 16}, {0, 255, 255, 0})
{{1, 255, 0, 0}, 16}
# same sized `bits`
iex> x = new(<<10, 11, 12, 13>>, 32)
iex> y = new(<<0, 0, 255, 255>>, 32)
iex> bor(x, y)
%Pfx{bits: <<10, 11, 255, 255>>, maxlen: 32}
# same `maxlen` but differently sized `bits`: missing bits are considered to be `0`
iex> bor("10.11.12.13", "255.255.0.0/16")
"255.255.12.13"
# result has same number of bits as the first prefix
iex> bor("10.10.0.0/16", "255.255.255.255")
"255.255.0.0/16"