Skip to content

splitBitPrefixInto

splitBitPrefixInto(prefix, subnetCount): BitPrefix[]

Defined in: packages/net-address/src/prefix/aggregate.ts:99

Divides a prefix into at least subnetCount equal subnets.

Subnets only come in powers of two, so asking for 3 gives 4. The extra blocks are returned rather than dropped: a caller splitting for allocation needs to know they exist.

BitPrefix

number

BitPrefix[]

RangeError When subnetCount is not a positive integer, or when the prefix cannot be divided that far.