diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2018-03-08 06:31:51 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2018-03-08 06:31:51 -0800 |
commit | 968e13cbbda2e9fc8a7e8d91cd35d4ac93c695b9 (patch) | |
tree | 64a21f73c14e10b010c02cee1651b7ab4fa73838 /struct.c | |
parent | 18bd289d8deadce78123cc54f3730b9d78883f22 (diff) | |
download | txr-968e13cbbda2e9fc8a7e8d91cd35d4ac93c695b9.tar.gz txr-968e13cbbda2e9fc8a7e8d91cd35d4ac93c695b9.tar.bz2 txr-968e13cbbda2e9fc8a7e8d91cd35d4ac93c695b9.zip |
bugfix: broken single-digit bignum multiplication.
* mpi/mpi.c (s_mp_mul_d): The test used for deciding
whether or not the multiplication will carry, and possibly
needs another digit of space, is broken. There are situations
in which a carry occurs (k > 0) in spite of the test being
negative. We code this the way it should have been done in
the first place: resize the object when carry actually occurs.
This still avoids calling s_mp_pad unless absolutely
necessary, as the removed comment says. Also, in the carry
case, we need not try to clamp away leading zeros.
Diffstat (limited to 'struct.c')
0 files changed, 0 insertions, 0 deletions