Closed konsumlamm closed 2 years ago
It seems to me that BigInts are always normalized (i.e. the highest limb is never 0, except if the number is 0), however, this isn't documented.
BigInt
If this is the case, I think at least isZero(n) could be optimized to just check n.limbs.len == 1 and n.limbs[0] (it currently uses a loop).
isZero(n)
n.limbs.len == 1 and n.limbs[0]
It seems to me that
BigInt
s are always normalized (i.e. the highest limb is never 0, except if the number is 0), however, this isn't documented.If this is the case, I think at least
isZero(n)
could be optimized to just checkn.limbs.len == 1 and n.limbs[0]
(it currently uses a loop).