Mail Archives: djgpp/2001/08/08/10:16:38
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<=
eliz AT is DOT elta DOT co DOT il> on: 08.08.01 15:51:59</FONT></p>
<p><FONT SIZE=3D1>></FONT></p>
<p><FONT SIZE=3D2>>>I want to do simple 128 bit integer math=
(+ and -). Do I have to combine</FONT></p>
<p><FONT SIZE=3D2>>>two long long int by myself or is there=
something like a library or a</FONT></p>
<p><FONT SIZE=3D2>>>little bit free source code which does=
that job?</FONT></p>
<p><FONT SIZE=3D2>></FONT></p>
<p><FONT SIZE=3D2>>Check out the GNU Multiple-Precision library,=
v2gnu/gmp311b.zip from the</FONT></p>
<p><FONT SIZE=3D2>>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 -