Commit graph

11 commits

Author SHA1 Message Date
Dag-Erling Smørgrav
1c024928f9 Fix off-by-one bug in mpi_cmp() which could cause it to read past the
end of the buffer.
2014-12-30 16:35:13 +00:00
Dag-Erling Smørgrav
43b870dc83 WIP: implement subtraction correctly. The actual result is now correct
most of the time, but the MSB calculation is not.
2014-12-30 11:23:30 +00:00
Dag-Erling Smørgrav
7524a14386 comment nit 2014-12-30 11:15:28 +00:00
Dag-Erling Smørgrav
c5b962387c Add mpi_eq_abs() and mpi_eq() predicates. 2014-12-30 11:12:11 +00:00
Dag-Erling Smørgrav
bc8e9d67ba In both mpi_add_abs() and mpi_sub_abs(), make sure that the target is
untouched if the operation fails.  Also ensure that A = A +/- A works.
2014-12-29 23:44:34 +00:00
Dag-Erling Smørgrav
98c6349d4a In mpi_zero(), save a memset() if the target is already zero. 2014-12-29 23:22:54 +00:00
Dag-Erling Smørgrav
1412dac680 Shifting any number by zero places is a no-op, but so is shifting zero by
any number of places.
2014-12-29 23:20:26 +00:00
Dag-Erling Smørgrav
8228f19d5a In mpi_copy(), any failure should leave the target untouched. 2014-12-29 23:18:57 +00:00
Dag-Erling Smørgrav
82f5c5cf77 In mpi_load(), use be32dec() when possible.
In mpi_set(), it is impossible for the value being loaded to exceed
the minimum size of an mpi; thus, there is no need for mpi_grow().
2014-12-29 15:08:09 +00:00
Dag-Erling Smørgrav
d4fd9a1958 rm unused variable 2014-08-12 07:33:30 +00:00
Dag-Erling Smørgrav
be31515f5e Start of a multiple-precision integer arithmetic library. 2014-08-12 07:30:31 +00:00