1 /**************************************************************************
2 ** (c) Copyright 1999, Andromeda Technology & Automation
3 ***************************************************************************
4 ** MODULE INFORMATION *
5 ***********************
6 ** FILE NAME : integer.h
7 ** SYSTEM NAME : AXE - Andromeda X-windows Encapsulation
8 ** VERSION NUMBER : $Revision: 1.1 $
10 ** DESCRIPTION : Arbitrary length integer
15 ***************************************************************************
16 ** ADMINISTRATIVE INFORMATION *
17 ********************************
18 ** ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl
19 ** CREATION DATE : Feb 06, 1998
20 ** LAST UPDATE : Oct 16, 1999
22 **************************************************************************/
24 /*****************************
26 Revision 1.1 2002-07-25 08:01:27 arjen
27 First checkin, AXE release 0.2
29 *****************************/
31 /* static const char *RCSID = "$Id: integer.h,v 1.1 2002-07-25 08:01:27 arjen Exp $"; */
37 * The integer class (not int !) implements an arbitrary length
38 * number. It allocates more words as the number grows.
39 * When a number consists of more than one word, only the first
40 * is signed (the most significant), the rest of the words is
43 * When adding, overflow is detected if the addends are of the same
44 * sign and the result has a different sign.
50 short msw; // Most significant word, in 2s complement
51 unsigned short *Number; // least significant words.
64 Number = new unsigned short[1];
75 integer& operator=(integer &);
76 integer operator+(integer &);
84 friend ostream& operator<<(ostream&, integer&);
85 friend istream& operator>>(istream&, integer&);