1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
5 -- I N T E R F A C E S --
9 -- Copyright (C) 2002-2023, Free Software Foundation, Inc. --
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 --
13 -- apply solely to the implementation dependent sections of this file. --
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- --
17 -- ware Foundation; either version 3, or (at your option) any later ver- --
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 --
20 -- or FITNESS FOR A PARTICULAR PURPOSE. --
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. --
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/>. --
31 -- GNAT was originally developed by the GNAT team at New York University. --
32 -- Extensive contributions were provided by Ada Core Technologies Inc. --
34 ------------------------------------------------------------------------------
36 -- This is the runtime version of this unit (not used during GNAT build)
38 package Interfaces
with
41 pragma No_Elaboration_Code_All
;
44 -- All identifiers in this unit are implementation defined
46 pragma Implementation_Defined
;
48 type Integer_8
is range -2 ** 7 .. 2 ** 7 - 1;
49 for Integer_8
'Size use 8;
51 type Integer_16
is range -2 ** 15 .. 2 ** 15 - 1;
52 for Integer_16
'Size use 16;
54 type Integer_32
is range -2 ** 31 .. 2 ** 31 - 1;
55 for Integer_32
'Size use 32;
57 type Integer_64
is new Long_Long_Integer;
58 for Integer_64
'Size use 64;
59 -- Note: we use Long_Long_Integer'First instead of -2 ** 63 to allow this
60 -- unit to compile when using custom target configuration files where the
61 -- maximum integer is 32 bits. This is useful for static analysis tools
62 -- such as SPARK or CodePeer. In the normal case Long_Long_Integer is
63 -- always 64-bits so we get the desired 64-bit type.
65 type Integer_128
is new Long_Long_Long_Integer
;
66 -- Note: we use Long_Long_Long_Integer instead of literal bounds to allow
67 -- this unit to be compiled with compilers not supporting 128-bit integers.
68 -- We do not put a confirming size clause of 128 bits for the same reason.
70 type Unsigned_8
is mod 2 ** 8;
71 for Unsigned_8
'Size use 8;
73 type Unsigned_16
is mod 2 ** 16;
74 for Unsigned_16
'Size use 16;
76 type Unsigned_24
is mod 2 ** 24;
77 for Unsigned_24
'Size use 24;
78 -- Declare this type for compatibility with legacy Ada compilers.
79 -- This is particularly useful in the context of CodePeer analysis.
81 type Unsigned_32
is mod 2 ** 32;
82 for Unsigned_32
'Size use 32;
84 type Unsigned_64
is mod 2 ** Long_Long_Integer'Size;
85 for Unsigned_64
'Size use 64;
86 -- See comment on Integer_64 above
88 type Unsigned_128
is mod 2 ** Long_Long_Long_Integer
'Size;
89 -- See comment on Integer_128 above
93 Amount
: Natural) return Unsigned_8
94 with Import
, Convention
=> Intrinsic
, Static
;
98 Amount
: Natural) return Unsigned_8
99 with Import
, Convention
=> Intrinsic
, Static
;
101 function Shift_Right_Arithmetic
103 Amount
: Natural) return Unsigned_8
104 with Import
, Convention
=> Intrinsic
, Static
;
108 Amount
: Natural) return Unsigned_8
109 with Import
, Convention
=> Intrinsic
, Static
;
111 function Rotate_Right
113 Amount
: Natural) return Unsigned_8
114 with Import
, Convention
=> Intrinsic
, Static
;
117 (Value
: Unsigned_16
;
118 Amount
: Natural) return Unsigned_16
119 with Import
, Convention
=> Intrinsic
, Static
;
122 (Value
: Unsigned_16
;
123 Amount
: Natural) return Unsigned_16
124 with Import
, Convention
=> Intrinsic
, Static
;
126 function Shift_Right_Arithmetic
127 (Value
: Unsigned_16
;
128 Amount
: Natural) return Unsigned_16
129 with Import
, Convention
=> Intrinsic
, Static
;
132 (Value
: Unsigned_16
;
133 Amount
: Natural) return Unsigned_16
134 with Import
, Convention
=> Intrinsic
, Static
;
136 function Rotate_Right
137 (Value
: Unsigned_16
;
138 Amount
: Natural) return Unsigned_16
139 with Import
, Convention
=> Intrinsic
, Static
;
142 (Value
: Unsigned_32
;
143 Amount
: Natural) return Unsigned_32
144 with Import
, Convention
=> Intrinsic
, Static
;
147 (Value
: Unsigned_32
;
148 Amount
: Natural) return Unsigned_32
149 with Import
, Convention
=> Intrinsic
, Static
;
151 function Shift_Right_Arithmetic
152 (Value
: Unsigned_32
;
153 Amount
: Natural) return Unsigned_32
154 with Import
, Convention
=> Intrinsic
, Static
;
157 (Value
: Unsigned_32
;
158 Amount
: Natural) return Unsigned_32
159 with Import
, Convention
=> Intrinsic
, Static
;
161 function Rotate_Right
162 (Value
: Unsigned_32
;
163 Amount
: Natural) return Unsigned_32
164 with Import
, Convention
=> Intrinsic
, Static
;
167 (Value
: Unsigned_64
;
168 Amount
: Natural) return Unsigned_64
169 with Import
, Convention
=> Intrinsic
, Static
;
172 (Value
: Unsigned_64
;
173 Amount
: Natural) return Unsigned_64
174 with Import
, Convention
=> Intrinsic
, Static
;
176 function Shift_Right_Arithmetic
177 (Value
: Unsigned_64
;
178 Amount
: Natural) return Unsigned_64
179 with Import
, Convention
=> Intrinsic
, Static
;
182 (Value
: Unsigned_64
;
183 Amount
: Natural) return Unsigned_64
184 with Import
, Convention
=> Intrinsic
, Static
;
186 function Rotate_Right
187 (Value
: Unsigned_64
;
188 Amount
: Natural) return Unsigned_64
189 with Import
, Convention
=> Intrinsic
, Static
;
192 (Value
: Unsigned_128
;
193 Amount
: Natural) return Unsigned_128
194 with Import
, Convention
=> Intrinsic
, Static
;
197 (Value
: Unsigned_128
;
198 Amount
: Natural) return Unsigned_128
199 with Import
, Convention
=> Intrinsic
, Static
;
201 function Shift_Right_Arithmetic
202 (Value
: Unsigned_128
;
203 Amount
: Natural) return Unsigned_128
204 with Import
, Convention
=> Intrinsic
, Static
;
207 (Value
: Unsigned_128
;
208 Amount
: Natural) return Unsigned_128
209 with Import
, Convention
=> Intrinsic
, Static
;
211 function Rotate_Right
212 (Value
: Unsigned_128
;
213 Amount
: Natural) return Unsigned_128
214 with Import
, Convention
=> Intrinsic
, Static
;
216 -- IEEE Floating point types
218 type IEEE_Float_32
is digits 6;
219 for IEEE_Float_32
'Size use 32;
221 type IEEE_Float_64
is digits 15;
222 for IEEE_Float_64
'Size use 64;
224 -- If there is an IEEE extended float available on the machine, we assume
225 -- that it is available as Long_Long_Float.
227 -- Note: it is harmless, and explicitly permitted, to include additional
228 -- types in interfaces, so it is not wrong to have IEEE_Extended_Float
229 -- defined even if the extended format is not available.
231 type IEEE_Extended_Float
is new Long_Long_Float;