nim-lang / bigints

BigInts for Nim
MIT License
124 stars 32 forks source link

Are `BigInt`s always normalized? #44

Closed konsumlamm closed 2 years ago

konsumlamm commented 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.

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).