Commit graph

19 commits

Author SHA1 Message Date
Dag-Erling Smørgrav
dc43296a47 Centralize most of .gitignore. 2016-09-17 21:38:54 +02:00
Dag-Erling Smørgrav
06a757e878 Big reorganization and cleanup 2016-09-04 14:56:39 +02:00
Dag-Erling Smørgrav
4d7893004c Prepare for moving to Github 2015-12-14 15:55:38 +01:00
Dag-Erling Smørgrav
94471e9923 Always clear the negative flag in mpi_zero() 2015-10-03 14:23:32 +00:00
Dag-Erling Smørgrav
a33f58cad7 Fix equality predicate. 2015-01-07 19:23:38 +00:00
Dag-Erling Smørgrav
d0fb2359f1 Implement mpi_{add,sub}() in terms of mpi_{add,sub}_abs(). 2015-01-07 18:59:44 +00:00
Dag-Erling Smørgrav
7a90ca7b42 Since X may point to the same MPI as either G or L (or even both), we
can't set the carry flag based on the contents of G or L after having
modified X.  Instead, compute and stash the new carry value first.
2014-12-30 19:14:59 +00:00
Dag-Erling Smørgrav
0d483f20ab Fix msb calculation. We may have to backtrack quite a bit, for
instance when subtracting two nearly equal large numbers.
2014-12-30 16:45:18 +00:00
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