libtom/libtommath

MP_DIGIT_BIT==8*sizeof (mp_digit)

minad opened this issue · 3 comments

minad commented

Why are we not always having MP_DIGIT_BIT==8*sizeof (mp_digit)-1? I ran tests with MP_DIGIT_BIT 63 and it worked. I think @czurnieden explained me once why this is not the case, but I forgot.

I only found #48 (comment)

minad commented

Ok, I have to understand this better. The thing is that we also have 31 bit which is weird then. Furthermore we could add some static assertions at some places which would break if digit_bit is too large? This would help a lot I guess.

minad commented

I think we could try to use the full digits (MP_DIGIT_BIT=8*sizeof(mp_digit)). First, addition with carry of digits must be handled differently (either by adding mp_words or by optionally using some compiler builtin). Second, the comba multiplier gets more difficult since we cannot use an mp_word as accumulator, but have to use an three mp_digits (mp_digit _W[3], instead of mp_word _W). See also #429.