From: Matt McCutchen Date: Sat, 27 Jan 2007 21:06:19 +0000 (-0500) Subject: Old snapshot `bigint-2006.05.01'; see the ChangeLog file. X-Git-Tag: v2007.07.07~9 X-Git-Url: https://mattmccutchen.net/bigint/bigint.git/commitdiff_plain/26a5f52b24d9c9733139a6cf29647f1de7915a56 Old snapshot `bigint-2006.05.01'; see the ChangeLog file. --- diff --git a/.cdtproject b/.cdtproject new file mode 100644 index 0000000..998bcd2 --- /dev/null +++ b/.cdtproject @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.project b/.project new file mode 100644 index 0000000..d6e8622 --- /dev/null +++ b/.project @@ -0,0 +1,89 @@ + + + bigint + + + + + + org.eclipse.cdt.make.core.makeBuilder + + + org.eclipse.cdt.make.core.build.arguments + + + + org.eclipse.cdt.core.errorOutputParser + org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GASErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.VCErrorParser; + + + org.eclipse.cdt.make.core.enableAutoBuild + true + + + org.eclipse.cdt.make.core.environment + + + + org.eclipse.cdt.make.core.enableFullBuild + true + + + org.eclipse.cdt.make.core.build.target.inc + all + + + org.eclipse.cdt.make.core.enabledIncrementalBuild + true + + + org.eclipse.cdt.make.core.build.location + + + + org.eclipse.cdt.make.core.build.target.clean + clean + + + org.eclipse.cdt.make.core.build.command + make + + + org.eclipse.cdt.make.core.enableCleanBuild + true + + + org.eclipse.cdt.make.core.append_environment + true + + + org.eclipse.cdt.make.core.build.target.full + clean all + + + org.eclipse.cdt.make.core.useDefaultBuildCmd + true + + + org.eclipse.cdt.make.core.build.target.auto + all + + + org.eclipse.cdt.make.core.stopOnError + false + + + + + org.eclipse.cdt.make.core.ScannerConfigBuilder + + + + + + org.eclipse.cdt.core.cnature + org.eclipse.cdt.make.core.makeNature + org.eclipse.cdt.make.core.ScannerConfigNature + org.eclipse.cdt.core.ccnature + + diff --git a/BigInteger.cc b/BigInteger.cc index 0ad7fc1..f70b021 100644 --- a/BigInteger.cc +++ b/BigInteger.cc @@ -1,6 +1,5 @@ /* * Matt McCutchen's Big Integer Library -* http://hashproduct.metaesthetics.net/bigint/ */ #include "BigInteger.hh" diff --git a/BigInteger.hh b/BigInteger.hh index 5a091ad..c6bd908 100644 --- a/BigInteger.hh +++ b/BigInteger.hh @@ -1,6 +1,5 @@ /* * Matt McCutchen's Big Integer Library -* http://hashproduct.metaesthetics.net/bigint/ */ #ifndef BIGINTEGER diff --git a/BigIntegerLibrary.hh b/BigIntegerLibrary.hh index 7f93b7d..2f01a3b 100644 --- a/BigIntegerLibrary.hh +++ b/BigIntegerLibrary.hh @@ -1,6 +1,5 @@ /* * Matt McCutchen's Big Integer Library -* http://hashproduct.metaesthetics.net/bigint/ */ // This header file includes all the other header files. diff --git a/BigIntegerUtils.cc b/BigIntegerUtils.cc index 636a4d7..ea00ed2 100644 --- a/BigIntegerUtils.cc +++ b/BigIntegerUtils.cc @@ -1,6 +1,5 @@ /* * Matt McCutchen's Big Integer Library -* http://hashproduct.metaesthetics.net/bigint/ */ #include "BigIntegerUtils.hh" diff --git a/BigIntegerUtils.hh b/BigIntegerUtils.hh index 0587c96..118179b 100644 --- a/BigIntegerUtils.hh +++ b/BigIntegerUtils.hh @@ -1,6 +1,5 @@ /* * Matt McCutchen's Big Integer Library -* http://hashproduct.metaesthetics.net/bigint/ */ #ifndef BIGINTEGERUTILS diff --git a/BigUnsigned.cc b/BigUnsigned.cc index 10c47db..33fe0af 100644 --- a/BigUnsigned.cc +++ b/BigUnsigned.cc @@ -1,6 +1,5 @@ /* * Matt McCutchen's Big Integer Library -* http://hashproduct.metaesthetics.net/bigint/ */ #include "BigUnsigned.hh" @@ -428,7 +427,7 @@ void BigUnsigned::multiply(const BigUnsigned &a, const BigUnsigned &b) { for (i = 0; i < a.len; i++) { // For each 1-bit of that block... for (i2 = 0; i2 < N; i2++) { - if ((a.blk[i] & (1 << i2)) == 0) + if ((a.blk[i] & (Blk(1) << i2)) == 0) continue; /* * Add b to this, shifted left i blocks and i2 bits. @@ -623,7 +622,7 @@ void BigUnsigned::divideWithRemainder(const BigUnsigned &b, BigUnsigned &q) { * the region of work2 we copy is just [i, k). */ if (!borrowIn) { - q.blk[i] |= (1 << i2); + q.blk[i] |= (Blk(1) << i2); while (k > i) { k--; blk[k] = work2[k]; diff --git a/BigUnsigned.hh b/BigUnsigned.hh index a62b7db..3e7aa10 100644 --- a/BigUnsigned.hh +++ b/BigUnsigned.hh @@ -1,6 +1,5 @@ /* * Matt McCutchen's Big Integer Library -* http://hashproduct.metaesthetics.net/bigint/ */ #ifndef BIGUNSIGNED diff --git a/BigUnsignedInABase.cc b/BigUnsignedInABase.cc index 762f14e..f2a6f79 100644 --- a/BigUnsignedInABase.cc +++ b/BigUnsignedInABase.cc @@ -1,6 +1,5 @@ /* * Matt McCutchen's Big Integer Library -* http://hashproduct.metaesthetics.net/bigint/ */ /* diff --git a/BigUnsignedInABase.hh b/BigUnsignedInABase.hh index a2e4068..4096907 100644 --- a/BigUnsignedInABase.hh +++ b/BigUnsignedInABase.hh @@ -1,6 +1,5 @@ /* * Matt McCutchen's Big Integer Library -* http://hashproduct.metaesthetics.net/bigint/ */ #ifndef BIGUNSIGNEDINABASE diff --git a/ChangeLog b/ChangeLog index 25bc9fc..7aaced1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,11 +1,14 @@ +===================================================================+ Matt McCutchen's Big Integer Library -http://hashproduct.metaesthetics.net/bigint/ Change Log ========== These entries tell you what was added, fixed, or improved in each version as compared to the previous one. In case you haven't noticed, a version number roughly corresponds to the release date of that version in `YYYY.MM.DD[.N]' format, where `.N' goes `.2', `.3', etc. if there are multiple versions on the same day. +2006.05.01 +---------- +I fixed incorrect results reported by Mohand Mezmaz and related memory corruption on platforms where Blk is bigger than int. I replaced (1 << x) with (Blk(1) << x) in two places in BigUnsigned.cc. + 2006.04.24 ---------- Two bug fixes: BigUnsigned "++x" no longer segfaults when x grows in length, and BigUnsigned == and != are now redeclared so as to be usable. I redid the Makefile: I removed the *.tag mechanism and hard-coded the library's header dependencies, I added comments, and I made the Makefile more useful for building one's own programs instead of just the sample. diff --git a/Makefile b/Makefile index c99cf54..ab917ec 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,5 @@ # # Matt McCutchen's Big Integer Library -# http://hashproduct.metaesthetics.net/bigint/ # # Mention default target. diff --git a/NumberlikeArray.hh b/NumberlikeArray.hh index 552ecfb..ab0aae0 100644 --- a/NumberlikeArray.hh +++ b/NumberlikeArray.hh @@ -1,6 +1,5 @@ /* * Matt McCutchen's Big Integer Library -* http://hashproduct.metaesthetics.net/bigint/ */ /* diff --git a/README b/README index 6fb020e..f45ea24 100644 --- a/README +++ b/README @@ -1,11 +1,12 @@ +===================================================================+ | Big Integer Library | | A C++ library that does arithmetic on integers of unlimited size. | -| Version 2006.02.26 | +| Version 2006.05.01 | +-------------------------------------------------------------------+ | By Matt McCutchen | -| E-mail: hashproduct@verizon.net | -| Project Web site: http://hashproduct.metaesthetics.net/bigint/ | +| E-mail: hashproduct@gmail.com | +| My Web site gateway: http://mysite.verizon.net/hashproduct/ | +| Project Web site: http://www.kepreon.com/~matt/bigint/ | +===================================================================+ What the Big Integer Library provides @@ -30,6 +31,6 @@ The library has been tested by myself and others but is by no means bug-free. T Keep in touch ============= -Feel free to e-mail me at `hashproduct@verizon.net' to report bugs or request features. When I fix the bug or add the feature, you will generally be credited by name in the source code and/or the Change Log unless you request otherwise. I am also curious as to what uses you find for the library. If you would like an e-mail whenever a new version of the library is released, e-mail me to join my informal mailing list. New versions of the library will be available at the project Web site at `http://hashproduct.metaesthetics.net/bigint/'. +Feel free to e-mail me at `hashproduct@gmail.com' to report bugs or request features. When I fix the bug or add the feature, you will generally be credited by name in the source code and/or the Change Log unless you request otherwise. I am also curious as to what uses you find for the library. New versions of the library will be available at the project Web site. ===================================================================== \ No newline at end of file diff --git a/sample.cc b/sample.cc index 5eab984..5344781 100644 --- a/sample.cc +++ b/sample.cc @@ -1,6 +1,5 @@ /* * Matt McCutchen's Big Integer Library -* http://hashproduct.metaesthetics.net/bigint/ */ /*