www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/08/08/10:16:38

From: Kai Dietrich <toepferei DOT dietrich AT t-online DOT de>
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: <Pine DOT SUN DOT 3 DOT 91 DOT 1010808155014 DOT 25973A-100000 AT is>
Mime-Version: 1.0
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

<html>
<BASEFONT FACE=3D"MS Sans Serif" COLOR=3D#000000>
<p><FONT SIZE=3D2>Message by Eli Zaretskii&lt;=
 eliz AT is DOT elta DOT co DOT il&gt; on: 08.08.01 15:51:59</FONT></p>
<p><FONT SIZE=3D1>&gt;</FONT></p>
<p><FONT SIZE=3D2>&gt;&gt;I want to do simple 128 bit integer math=
 (+ and -). Do I have to combine</FONT></p>
<p><FONT SIZE=3D2>&gt;&gt;two long long int by myself or is there=
 something like a library or a</FONT></p>
<p><FONT SIZE=3D2>&gt;&gt;little bit free source code which does=
 that job?</FONT></p>
<p><FONT SIZE=3D2>&gt;</FONT></p>
<p><FONT SIZE=3D2>&gt;Check out the GNU Multiple-Precision library,=
 v2gnu/gmp311b.zip from the</FONT></p>
<p><FONT SIZE=3D2>&gt;usual DJGPP sites.</FONT></p>
<p><FONT SIZE=3D2>Hmm, obviosly I havn't said enough. GMP is not=
 exactly what I want. I need a constant size like</FONT></p>
<p><FONT SIZE=3D2>class _int128</FONT></p>
<p><FONT SIZE=3D2>\{</FONT></p>
<p><FONT SIZE=3D2>public:</FONT></p>
<p><FONT SIZE=3D2>long long v[2];</FONT></p>
<p><FONT SIZE=3D2>\};</FONT></p>
<p><FONT SIZE=3D2>I need the wrap around effect (eg when doing 0xff=
 +0x0 on a single byte) but for the whole </FONT><FONT=
 SIZE=3D2>128bits and not every single byte. Also I have to acces=
 the single bytes via</FONT></p>
<p><FONT SIZE=3D2>_int128 a;</FONT></p>
<p><FONT SIZE=3D2>char *b=3D(char *)a.v;</FONT></p>
<p><FONT SIZE=3D2>b[0]=3D0xff;</FONT></p>
<p><FONT SIZE=3D2>b[1]=3D0xff;</FONT></p>
<p><FONT SIZE=3D2>...</FONT></p>
<p><FONT SIZE=3D2>I want the solution to behave like long long but=
 with 128 bits (256 or more would be OK, too) </FONT><FONT=
 SIZE=3D2>instead of 64. I know that it is possible, it is the same=
 solution like getting long long working on </FONT><FONT SIZE=3D2>a=
 32bit machine. I would be able to combined two long long but I=
 can only write + not - :-(. I need </FONT><FONT SIZE=3D2>a little=
 bit help writing</FONT></p>
<p><FONT SIZE=3D2>_int128 add(_int128 a, _int128 b);</FONT></p>
<p><FONT SIZE=3D2>_int128 sub(_int128 a, _int128 b);</FONT></p>
<p></p>

</html>


--75205647--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019