Skip to content

bitRangeToPrefixes

bitRangeToPrefixes(range): BitPrefix[]

Defined in: packages/net-address/src/prefix/bit-range.ts:109

The shortest list of prefixes covering exactly the range and nothing more.

At each step it emits the largest block that both starts at the current address and fits in what is left, which is the standard range-to-CIDR decomposition. At most 2 * bitWidth - 2 prefixes come out, so the result is bounded however wide the range is.

BitRange

BitPrefix[]

RangeError When the widths differ or last precedes first.