From: Kai Dietrich Newsgroups: comp.os.msdos.djgpp Subject: Re: 128 bit integer Date: Wed, 8 Aug 2001 16:02:26 +0200 Organization: T-Online Lines: 94 Message-ID: <9krgph$496$04$1@news.t-online.com> References: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="75205647" X-Trace: news.t-online.com 997279346 04 4390 PtWRSmESSJAMqC 010808 14:02:26 X-Complaints-To: abuse AT t-online DOT com X-Sender: 320009961467-0001 AT t-dialin DOT net To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com This is a multipart message in MIME format --75205647 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Message by Eli Zaretskii< eliz AT is DOT elta DOT co DOT il> on: 08.08.01= 15:51:59 > >>I want to do simple 128 bit integer math (+ and -). Do I have= to combine >>two long long int by myself or is there something like a= library or a >>little bit free source code which does that job? > >Check out the GNU Multiple-Precision library, v2gnu/gmp311b.zip= from the >usual DJGPP sites. Hmm, obviosly I havn't said enough. GMP is not exactly what I= want. I need a constant size like class _int128 { public: long long v[2]; }; I need the wrap around effect (eg when doing 0xff +0x0 on a= single byte) but for the whole 128bits and not every single= byte. Also I have to acces the single bytes via _int128 a; char *b=3D(char *)a.v; b[0]=3D0xff; b[1]=3D0xff; .. I want the solution to behave like long long but with 128 bits= (256 or more would be OK, too) instead of 64. I know that it is= possible, it is the same solution like getting long long working= on a 32bit machine. I would be able to combined two long long= but I can only write + not - :-(. I need a little bit help= writing _int128 add(_int128 a, _int128 b); _int128 sub(_int128 a, _int128 b); --75205647 Content-Type: text/html Content-Transfer-Encoding: Quoted-Printable

Message by Eli Zaretskii<= eliz AT is DOT elta DOT co DOT il> on: 08.08.01 15:51:59

>

>>I want to do simple 128 bit integer math= (+ and -). Do I have to combine

>>two long long int by myself or is there= something like a library or a

>>little bit free source code which does= that job?

>

>Check out the GNU Multiple-Precision library,= v2gnu/gmp311b.zip from the

>usual DJGPP sites.

Hmm, obviosly I havn't said enough. GMP is not= exactly what I want. I need a constant size like

class _int128

\{

public:

long long v[2];

\};

I need the wrap around effect (eg when doing 0xff= +0x0 on a single byte) but for the whole 128bits and not every single byte. Also I have to acces= the single bytes via

_int128 a;

char *b=3D(char *)a.v;

b[0]=3D0xff;

b[1]=3D0xff;

...

I want the solution to behave like long long but= with 128 bits (256 or more would be OK, too) instead of 64. I know that it is possible, it is the same= solution like getting long long working on a= 32bit machine. I would be able to combined two long long but I= can only write + not - :-(. I need a little= bit help writing

_int128 add(_int128 a, _int128 b);

_int128 sub(_int128 a, _int128 b);

--75205647--