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.2 $
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.2 2002-11-04 07:24:31 arjen
27 Use proper namespace for iostream classes
29 Revision 1.1 2002/07/25 08:01:27 arjen
30 First checkin, AXE release 0.2
32 *****************************/
34 /* static const char *RCSID = "$Id: integer.h,v 1.2 2002-11-04 07:24:31 arjen Exp $"; */
40 * The integer class (not int !) implements an arbitrary length
41 * number. It allocates more words as the number grows.
42 * When a number consists of more than one word, only the first
43 * is signed (the most significant), the rest of the words is
46 * When adding, overflow is detected if the addends are of the same
47 * sign and the result has a different sign.
53 short msw; // Most significant word, in 2s complement
54 unsigned short *Number; // least significant words.
67 Number = new unsigned short[1];
78 integer& operator=(integer &);
79 integer operator+(integer &);
87 friend std::ostream& operator<<(std::ostream&, integer&);
88 friend std::istream& operator>>(std::istream&, integer&);