2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / ada / uintp.h
blob35f5c9f8bc8cc4da418761fdb100afd4b6fdbdeb
1 /****************************************************************************
2 * *
3 * GNAT COMPILER COMPONENTS *
4 * *
5 * U I N T P *
6 * *
7 * C Header File *
8 * *
9 * Copyright (C) 1992-2002, Free Software Foundation, Inc. *
10 * *
11 * GNAT is free software; you can redistribute it and/or modify it under *
12 * terms of the GNU General Public License as published by the Free Soft- *
13 * ware Foundation; either version 2, or (at your option) any later ver- *
14 * sion. GNAT is distributed in the hope that it will be useful, but WITH- *
15 * OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *
16 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License *
17 * for more details. You should have received a copy of the GNU General *
18 * Public License distributed with GNAT; see file COPYING. If not, write *
19 * to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, *
20 * MA 02111-1307, USA. *
21 * *
22 * GNAT was originally developed by the GNAT team at New York University. *
23 * Extensive contributions were provided by Ada Core Technologies Inc. *
24 * *
25 ****************************************************************************/
27 /* This file corresponds to the Ada package specification Uintp. It was
28 created manually from the files uintp.ads and uintp.adb */
30 /* Support for universal integer arithmetic */
32 struct Uint_Entry
34 Pos Length;
35 Int Loc;
38 /* See if a Uint is within the range of an integer. */
39 #define UI_Is_In_Int_Range uintp__ui_is_in_int_range
40 extern Boolean UI_Is_In_Int_Range (Uint);
42 /* Obtain Int value from Uint input. This will abort if the result is
43 out of range. */
44 #define UI_To_Int uintp__ui_to_int
45 extern Int UI_To_Int (Uint);
47 /* Convert an Int into a Uint. */
48 #define UI_From_Int uintp__ui_from_int
49 extern Uint UI_From_Int (int);
51 /* Similarly, but return a GCC INTEGER_CST. Overflow is tested by the
52 constant-folding used to build the node. TYPE is the GCC type of the
53 resulting node. */
54 extern tree UI_To_gnu (Uint, tree);
56 /* Universal integers are represented by the Uint type which is an index into
57 the Uints_Ptr table containing Uint_Entry values. A Uint_Entry contains an
58 index and length for getting the "digits" of the universal integer from the
59 Udigits_Ptr table.
61 For efficiency, this method is used only for integer values larger than the
62 constant Uint_Bias. If a Uint is less than this constant, then it contains
63 the integer value itself. The origin of the Uints_Ptr table is adjusted so
64 that a Uint value of Uint_Bias indexes the first element. */
66 #define Uints_Ptr (uintp__uints__table - Uint_Table_Start)
67 extern struct Uint_Entry *uintp__uints__table;
69 #define Udigits_Ptr uintp__udigits__table
70 extern int *uintp__udigits__table;
72 #define Uint_0 (Uint_Direct_Bias + 0)
73 #define Uint_1 (Uint_Direct_Bias + 1)