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