MCPcopy Create free account
hub / github.com/OpenSN-Library/OpenSN-Library / array_add

Function array_add

TopoConfigurators/Standard/address_allocator.py:3–11  ·  view source on GitHub ↗
(base: list,delta: int)

Source from the content-addressed store, hash-verified

1IPV4_BASE = [10,0,0,0]
2
3def array_add(base: list,delta: int) -> list:
4 ret = [base[i] for i in range(len(base))]
5 for i in range(len(base)-1,-1,-1):
6 if delta == 0 :
7 break
8 delta = delta + base[i]
9 ret[i] = delta % 256
10 delta = delta // 256
11 return ret
12
13def alloc_ipv4(prefix_len: int) -> list:
14 global IPV4_BASE

Callers 1

alloc_ipv4Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected