Should `wordSizeInBase# base 0##` be 1 rather than 0 for every base?
While looking at porting the GMP support in cryptonite-0.28 to GHC 9.0.1, I noticed that the patch in head.hackage
updates Crypto.Number.Basic.numBytes
by special-casing 0
to return 1 (and should probably have done the same for numBits
). This is only needed because ultimately these now call wordSizeInBase#
, which counts 0
as having 0
digits in every base, but I think that 1
is the more correct answer.
The work-arounds would not be needed if wordSizeInBase#
were updated to return 1
when the input number is zero.