]>
Commit | Line | Data |
---|---|---|
38cbfe40 RK |
1 | ------------------------------------------------------------------------------ |
2 | -- -- | |
3 | -- GNAT COMPILER COMPONENTS -- | |
4 | -- -- | |
5 | -- I N T E R F A C E S -- | |
6 | -- -- | |
7 | -- S p e c -- | |
8 | -- -- | |
4b490c1e | 9 | -- Copyright (C) 2002-2020, Free Software Foundation, Inc. -- |
fbf5a39b AC |
10 | -- -- |
11 | -- This specification is derived from the Ada Reference Manual for use with -- | |
12 | -- GNAT. The copyright notice above, and the license provisions that follow -- | |
009186e0 | 13 | -- apply solely to the implementation dependent sections of this file. -- |
fbf5a39b AC |
14 | -- -- |
15 | -- GNAT is free software; you can redistribute it and/or modify it under -- | |
16 | -- terms of the GNU General Public License as published by the Free Soft- -- | |
748086b7 | 17 | -- ware Foundation; either version 3, or (at your option) any later ver- -- |
fbf5a39b AC |
18 | -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- |
19 | -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- | |
748086b7 JJ |
20 | -- or FITNESS FOR A PARTICULAR PURPOSE. -- |
21 | -- -- | |
22 | -- As a special exception under Section 7 of GPL version 3, you are granted -- | |
23 | -- additional permissions described in the GCC Runtime Library Exception, -- | |
24 | -- version 3.1, as published by the Free Software Foundation. -- | |
25 | -- -- | |
26 | -- You should have received a copy of the GNU General Public License and -- | |
27 | -- a copy of the GCC Runtime Library Exception along with this program; -- | |
28 | -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- | |
29 | -- <http://www.gnu.org/licenses/>. -- | |
fbf5a39b AC |
30 | -- -- |
31 | -- GNAT was originally developed by the GNAT team at New York University. -- | |
32 | -- Extensive contributions were provided by Ada Core Technologies Inc. -- | |
38cbfe40 RK |
33 | -- -- |
34 | ------------------------------------------------------------------------------ | |
35 | ||
4c51ff88 AC |
36 | pragma Compiler_Unit_Warning; |
37 | ||
38cbfe40 | 38 | package Interfaces is |
2cc2e964 | 39 | pragma No_Elaboration_Code_All; |
009186e0 | 40 | pragma Pure; |
38cbfe40 | 41 | |
df177175 RD |
42 | -- All identifiers in this unit are implementation defined |
43 | ||
44 | pragma Implementation_Defined; | |
45 | ||
38cbfe40 RK |
46 | type Integer_8 is range -2 ** 7 .. 2 ** 7 - 1; |
47 | for Integer_8'Size use 8; | |
48 | ||
49 | type Integer_16 is range -2 ** 15 .. 2 ** 15 - 1; | |
50 | for Integer_16'Size use 16; | |
51 | ||
52 | type Integer_32 is range -2 ** 31 .. 2 ** 31 - 1; | |
53 | for Integer_32'Size use 32; | |
54 | ||
697b781a | 55 | type Integer_64 is new Long_Long_Integer; |
38cbfe40 | 56 | for Integer_64'Size use 64; |
39f0fa29 | 57 | -- Note: we use Long_Long_Integer'First instead of -2 ** 63 to allow this |
697b781a AC |
58 | -- unit to compile when using custom target configuration files where the |
59 | -- maximum integer is 32 bits. This is useful for static analysis tools | |
60 | -- such as SPARK or CodePeer. In the normal case Long_Long_Integer is | |
61 | -- always 64-bits so we get the desired 64-bit type. | |
38cbfe40 | 62 | |
39f0fa29 | 63 | type Unsigned_8 is mod 2 ** 8; |
38cbfe40 RK |
64 | for Unsigned_8'Size use 8; |
65 | ||
66 | type Unsigned_16 is mod 2 ** 16; | |
67 | for Unsigned_16'Size use 16; | |
68 | ||
5a99fda7 AC |
69 | type Unsigned_24 is mod 2 ** 24; |
70 | for Unsigned_24'Size use 24; | |
71 | -- Declare this type for compatibility with legacy Ada compilers. | |
72 | -- This is particularly useful in the context of CodePeer analysis. | |
73 | ||
38cbfe40 RK |
74 | type Unsigned_32 is mod 2 ** 32; |
75 | for Unsigned_32'Size use 32; | |
76 | ||
39f0fa29 | 77 | type Unsigned_64 is mod 2 ** Long_Long_Integer'Size; |
38cbfe40 | 78 | for Unsigned_64'Size use 64; |
39f0fa29 | 79 | -- See comment on Integer_64 above |
38cbfe40 RK |
80 | |
81 | function Shift_Left | |
82 | (Value : Unsigned_8; | |
a5b62485 | 83 | Amount : Natural) return Unsigned_8; |
38cbfe40 RK |
84 | |
85 | function Shift_Right | |
86 | (Value : Unsigned_8; | |
a5b62485 | 87 | Amount : Natural) return Unsigned_8; |
38cbfe40 RK |
88 | |
89 | function Shift_Right_Arithmetic | |
90 | (Value : Unsigned_8; | |
a5b62485 | 91 | Amount : Natural) return Unsigned_8; |
38cbfe40 RK |
92 | |
93 | function Rotate_Left | |
94 | (Value : Unsigned_8; | |
a5b62485 | 95 | Amount : Natural) return Unsigned_8; |
38cbfe40 RK |
96 | |
97 | function Rotate_Right | |
98 | (Value : Unsigned_8; | |
a5b62485 | 99 | Amount : Natural) return Unsigned_8; |
38cbfe40 RK |
100 | |
101 | function Shift_Left | |
102 | (Value : Unsigned_16; | |
009186e0 | 103 | Amount : Natural) return Unsigned_16; |
38cbfe40 RK |
104 | |
105 | function Shift_Right | |
106 | (Value : Unsigned_16; | |
a5b62485 | 107 | Amount : Natural) return Unsigned_16; |
38cbfe40 RK |
108 | |
109 | function Shift_Right_Arithmetic | |
110 | (Value : Unsigned_16; | |
a5b62485 | 111 | Amount : Natural) return Unsigned_16; |
38cbfe40 RK |
112 | |
113 | function Rotate_Left | |
114 | (Value : Unsigned_16; | |
a5b62485 | 115 | Amount : Natural) return Unsigned_16; |
38cbfe40 RK |
116 | |
117 | function Rotate_Right | |
118 | (Value : Unsigned_16; | |
a5b62485 | 119 | Amount : Natural) return Unsigned_16; |
38cbfe40 RK |
120 | |
121 | function Shift_Left | |
122 | (Value : Unsigned_32; | |
a5b62485 | 123 | Amount : Natural) return Unsigned_32; |
38cbfe40 RK |
124 | |
125 | function Shift_Right | |
126 | (Value : Unsigned_32; | |
a5b62485 | 127 | Amount : Natural) return Unsigned_32; |
38cbfe40 RK |
128 | |
129 | function Shift_Right_Arithmetic | |
130 | (Value : Unsigned_32; | |
a5b62485 | 131 | Amount : Natural) return Unsigned_32; |
38cbfe40 RK |
132 | |
133 | function Rotate_Left | |
134 | (Value : Unsigned_32; | |
a5b62485 | 135 | Amount : Natural) return Unsigned_32; |
38cbfe40 RK |
136 | |
137 | function Rotate_Right | |
138 | (Value : Unsigned_32; | |
a5b62485 | 139 | Amount : Natural) return Unsigned_32; |
38cbfe40 RK |
140 | |
141 | function Shift_Left | |
142 | (Value : Unsigned_64; | |
a5b62485 | 143 | Amount : Natural) return Unsigned_64; |
38cbfe40 RK |
144 | |
145 | function Shift_Right | |
146 | (Value : Unsigned_64; | |
a5b62485 | 147 | Amount : Natural) return Unsigned_64; |
38cbfe40 RK |
148 | |
149 | function Shift_Right_Arithmetic | |
150 | (Value : Unsigned_64; | |
a5b62485 | 151 | Amount : Natural) return Unsigned_64; |
38cbfe40 RK |
152 | |
153 | function Rotate_Left | |
154 | (Value : Unsigned_64; | |
a5b62485 | 155 | Amount : Natural) return Unsigned_64; |
38cbfe40 RK |
156 | |
157 | function Rotate_Right | |
158 | (Value : Unsigned_64; | |
a5b62485 | 159 | Amount : Natural) return Unsigned_64; |
38cbfe40 RK |
160 | |
161 | pragma Import (Intrinsic, Shift_Left); | |
162 | pragma Import (Intrinsic, Shift_Right); | |
163 | pragma Import (Intrinsic, Shift_Right_Arithmetic); | |
164 | pragma Import (Intrinsic, Rotate_Left); | |
165 | pragma Import (Intrinsic, Rotate_Right); | |
166 | ||
ba0c6e47 | 167 | -- IEEE Floating point types |
70b352b5 RD |
168 | |
169 | type IEEE_Float_32 is digits 6; | |
0d5fbf52 | 170 | for IEEE_Float_32'Size use 32; |
70b352b5 RD |
171 | |
172 | type IEEE_Float_64 is digits 15; | |
0d5fbf52 | 173 | for IEEE_Float_64'Size use 64; |
70b352b5 RD |
174 | |
175 | -- If there is an IEEE extended float available on the machine, we assume | |
176 | -- that it is available as Long_Long_Float. | |
009186e0 | 177 | |
38cbfe40 RK |
178 | -- Note: it is harmless, and explicitly permitted, to include additional |
179 | -- types in interfaces, so it is not wrong to have IEEE_Extended_Float | |
180 | -- defined even if the extended format is not available. | |
181 | ||
38cbfe40 RK |
182 | type IEEE_Extended_Float is new Long_Long_Float; |
183 | ||
184 | end Interfaces; |