🐛 Fix serial number arithmetics
This commit is contained in:
parent
88d6f38e03
commit
c935fa152a
1 changed files with 3 additions and 2 deletions
5
lib.py
5
lib.py
|
@ -87,10 +87,11 @@ def update_serial(serial, serial_bits=32):
|
||||||
"""Update serial number
|
"""Update serial number
|
||||||
|
|
||||||
According to RFC 1982 and Knot implementation.
|
According to RFC 1982 and Knot implementation.
|
||||||
SERIAL_BITS = 32 by default.
|
SERIAL_BITS = 32 by default, which means the serial number counter can
|
||||||
|
range from 0 to 2^32 - 1.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
serial = serial + 1 % 2**32
|
serial = (serial + 1) % 2**serial_bits
|
||||||
|
|
||||||
return serial
|
return serial
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue