| 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 |
-- -- |
| 9 |
-- Copyright (C) 2002-2025, Free Software Foundation, Inc. -- |
| 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 -- |
| 13 |
-- apply solely to the implementation dependent sections of this file. -- |
| 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- -- |
| 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. -- |
| 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/>. -- |
| 30 |
-- -- |
| 31 |
-- GNAT was originally developed by the GNAT team at New York University. -- |
| 32 |
-- Extensive contributions were provided by Ada Core Technologies Inc. -- |
| 33 |
-- -- |
| 34 |
------------------------------------------------------------------------------ |
| 35 |
|
| 36 |
-- This is the compiler version of this unit |
| 37 |
|
| 38 |
package Interfaces with |
| 39 |
Always_Terminates |
| 40 |
is |
| 41 |
pragma No_Elaboration_Code_All; |
| 42 |
pragma Pure; |
| 43 |
|
| 44 |
-- All identifiers in this unit are implementation defined |
| 45 |
|
| 46 |
pragma Implementation_Defined; |
| 47 |
|
| 48 |
type Integer_8 is range -2 ** 7 .. 2 ** 7 - 1; |
| 49 |
for Integer_8'Size use 8; |
| 50 |
|
| 51 |
type Integer_16 is range -2 ** 15 .. 2 ** 15 - 1; |
| 52 |
for Integer_16'Size use 16; |
| 53 |
|
| 54 |
type Integer_32 is range -2 ** 31 .. 2 ** 31 - 1; |
| 55 |
for Integer_32'Size use 32; |
| 56 |
|
| 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. |
| 64 |
|
| 65 |
type Unsigned_8 is mod 2 ** 8; |
| 66 |
for Unsigned_8'Size use 8; |
| 67 |
|
| 68 |
type Unsigned_16 is mod 2 ** 16; |
| 69 |
for Unsigned_16'Size use 16; |
| 70 |
|
| 71 |
type Unsigned_24 is mod 2 ** 24; |
| 72 |
for Unsigned_24'Size use 24; |
| 73 |
-- Declare this type for compatibility with legacy Ada compilers. |
| 74 |
-- This is particularly useful in the context of CodePeer analysis. |
| 75 |
|
| 76 |
type Unsigned_32 is mod 2 ** 32; |
| 77 |
for Unsigned_32'Size use 32; |
| 78 |
|
| 79 |
type Unsigned_64 is mod 2 ** Long_Long_Integer'Size; |
| 80 |
for Unsigned_64'Size use 64; |
| 81 |
-- See comment on Integer_64 above |
| 82 |
|
| 83 |
function Shift_Left |
| 84 |
(Value : Unsigned_8; |
| 85 |
Amount : Natural) return Unsigned_8; |
| 86 |
|
| 87 |
function Shift_Right |
| 88 |
(Value : Unsigned_8; |
| 89 |
Amount : Natural) return Unsigned_8; |
| 90 |
|
| 91 |
function Shift_Right_Arithmetic |
| 92 |
(Value : Unsigned_8; |
| 93 |
Amount : Natural) return Unsigned_8; |
| 94 |
|
| 95 |
function Rotate_Left |
| 96 |
(Value : Unsigned_8; |
| 97 |
Amount : Natural) return Unsigned_8; |
| 98 |
|
| 99 |
function Rotate_Right |
| 100 |
(Value : Unsigned_8; |
| 101 |
Amount : Natural) return Unsigned_8; |
| 102 |
|
| 103 |
function Shift_Left |
| 104 |
(Value : Unsigned_16; |
| 105 |
Amount : Natural) return Unsigned_16; |
| 106 |
|
| 107 |
function Shift_Right |
| 108 |
(Value : Unsigned_16; |
| 109 |
Amount : Natural) return Unsigned_16; |
| 110 |
|
| 111 |
function Shift_Right_Arithmetic |
| 112 |
(Value : Unsigned_16; |
| 113 |
Amount : Natural) return Unsigned_16; |
| 114 |
|
| 115 |
function Rotate_Left |
| 116 |
(Value : Unsigned_16; |
| 117 |
Amount : Natural) return Unsigned_16; |
| 118 |
|
| 119 |
function Rotate_Right |
| 120 |
(Value : Unsigned_16; |
| 121 |
Amount : Natural) return Unsigned_16; |
| 122 |
|
| 123 |
function Shift_Left |
| 124 |
(Value : Unsigned_32; |
| 125 |
Amount : Natural) return Unsigned_32; |
| 126 |
|
| 127 |
function Shift_Right |
| 128 |
(Value : Unsigned_32; |
| 129 |
Amount : Natural) return Unsigned_32; |
| 130 |
|
| 131 |
function Shift_Right_Arithmetic |
| 132 |
(Value : Unsigned_32; |
| 133 |
Amount : Natural) return Unsigned_32; |
| 134 |
|
| 135 |
function Rotate_Left |
| 136 |
(Value : Unsigned_32; |
| 137 |
Amount : Natural) return Unsigned_32; |
| 138 |
|
| 139 |
function Rotate_Right |
| 140 |
(Value : Unsigned_32; |
| 141 |
Amount : Natural) return Unsigned_32; |
| 142 |
|
| 143 |
function Shift_Left |
| 144 |
(Value : Unsigned_64; |
| 145 |
Amount : Natural) return Unsigned_64; |
| 146 |
|
| 147 |
function Shift_Right |
| 148 |
(Value : Unsigned_64; |
| 149 |
Amount : Natural) return Unsigned_64; |
| 150 |
|
| 151 |
function Shift_Right_Arithmetic |
| 152 |
(Value : Unsigned_64; |
| 153 |
Amount : Natural) return Unsigned_64; |
| 154 |
|
| 155 |
function Rotate_Left |
| 156 |
(Value : Unsigned_64; |
| 157 |
Amount : Natural) return Unsigned_64; |
| 158 |
|
| 159 |
function Rotate_Right |
| 160 |
(Value : Unsigned_64; |
| 161 |
Amount : Natural) return Unsigned_64; |
| 162 |
|
| 163 |
pragma Import (Intrinsic, Shift_Left); |
| 164 |
pragma Import (Intrinsic, Shift_Right); |
| 165 |
pragma Import (Intrinsic, Shift_Right_Arithmetic); |
| 166 |
pragma Import (Intrinsic, Rotate_Left); |
| 167 |
pragma Import (Intrinsic, Rotate_Right); |
| 168 |
|
| 169 |
-- IEEE Floating point types |
| 170 |
|
| 171 |
type IEEE_Float_32 is digits 6; |
| 172 |
for IEEE_Float_32'Size use 32; |
| 173 |
|
| 174 |
type IEEE_Float_64 is digits 15; |
| 175 |
for IEEE_Float_64'Size use 64; |
| 176 |
|
| 177 |
-- If there is an IEEE extended float available on the machine, we assume |
| 178 |
-- that it is available as Long_Long_Float. |
| 179 |
|
| 180 |
-- Note: it is harmless, and explicitly permitted, to include additional |
| 181 |
-- types in interfaces, so it is not wrong to have IEEE_Extended_Float |
| 182 |
-- defined even if the extended format is not available. |
| 183 |
|
| 184 |
type IEEE_Extended_Float is new Long_Long_Float; |
| 185 |
|
| 186 |
end Interfaces; |