[Mono-list] BigInt implementation
Alexander Larsson
alexl@redhat.com
Mon, 21 Oct 2002 08:57:09 -0400 (EDT)
This message is in MIME format. The first part should be readable text,
while the remaining parts are likely unreadable without MIME-aware tools.
Send mail to mime@docserver.cac.washington.edu for more info.
--279707962-904132616-1035205029=:25817
Content-Type: TEXT/PLAIN; charset=US-ASCII
I noted on the mono mailinglist (I read the archives now and then) that
you needed a bignum implementation. I wrote a java BigInt class ages ago
(1996 to be exact). It probably need some cleaning up and changes for C#,
but might be interesting as a basis for something.
I have full copyright on this, so I can license it BSD style if you want
to use it.
--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Alexander Larsson Red Hat, Inc
alexl@redhat.com alla@lysator.liu.se
He's a suicidal gay romance novelist in a wheelchair. She's a beautiful
motormouth archaeologist operating on the wrong side of the law. They fight
crime!
--279707962-904132616-1035205029=:25817
Content-Type: TEXT/PLAIN; charset=US-ASCII; name="BigInt.java"
Content-Transfer-Encoding: BASE64
Content-ID: <Pine.LNX.4.44.0210210857090.25817@devserv.devel.redhat.com>
Content-Description:
Content-Disposition: attachment; filename="BigInt.java"
aW1wb3J0IGphdmEubGFuZy4qOw0KLyogDQoNCiAgVE9ETzoNCiAgIHBvdw0K
ICAgc2hpZnQgZnVuY3Rpb25zDQoNCiAgIHRlc3QsIHRlc3QsIHRlc3QuLi4g
KHBhcnRpY3VsYXJ5IGRpdikNCiovDQoNCg0KDQpwdWJsaWMgY2xhc3MgQmln
SW50IGltcGxlbWVudHMgQ2xvbmVhYmxlIHsNCi8vIFB1YmxpYyBDb25zdHJ1
Y3RvcnMNCiAgcHVibGljIEJpZ0ludChpbnQgeCkgeyANCiAgICBpZiAoeD09
LTB4ODAwMDAwMDApIHsNCiAgICAgIHZhbHVlPSBuZXcgaW50WzJdOw0KICAg
ICAgbGVuZ3RoPS0yOw0KICAgICAgdmFsdWVbMV09MTsNCiAgICAgIHZhbHV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