* config/riscv/riscv.c: Remove unnecessary includes. Reorder
[official-gcc.git] / gcc / ada / s-unstyp.ads
blobf9ad3853a0aea08a303aced76e5eeea7baff2841
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT RUN-TIME COMPONENTS --
4 -- --
5 -- S Y S T E M . U N S I G N E D _ T Y P E S --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 1992-2016, 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 3, 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. --
17 -- --
18 -- As a special exception under Section 7 of GPL version 3, you are granted --
19 -- additional permissions described in the GCC Runtime Library Exception, --
20 -- version 3.1, as published by the Free Software Foundation. --
21 -- --
22 -- You should have received a copy of the GNU General Public License and --
23 -- a copy of the GCC Runtime Library Exception along with this program; --
24 -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
25 -- <http://www.gnu.org/licenses/>. --
26 -- --
27 -- GNAT was originally developed by the GNAT team at New York University. --
28 -- Extensive contributions were provided by Ada Core Technologies Inc. --
29 -- --
30 ------------------------------------------------------------------------------
32 -- This package contains definitions of standard unsigned types that
33 -- correspond in size to the standard signed types declared in Standard,
34 -- and (unlike the types in Interfaces) have corresponding names. It
35 -- also contains some related definitions for other specialized types
36 -- used by the compiler in connection with packed array types.
38 pragma Compiler_Unit_Warning;
40 package System.Unsigned_Types is
41 pragma Pure;
42 pragma No_Elaboration_Code_All;
44 type Short_Short_Unsigned is mod 2 ** Short_Short_Integer'Size;
45 type Short_Unsigned is mod 2 ** Short_Integer'Size;
46 type Unsigned is mod 2 ** Integer'Size;
47 type Long_Unsigned is mod 2 ** Long_Integer'Size;
48 type Long_Long_Unsigned is mod 2 ** Long_Long_Integer'Size;
50 type Float_Unsigned is mod 2 ** Float'Size;
51 -- Used in the implementation of Is_Negative intrinsic (see Exp_Intr)
53 type Packed_Byte is mod 2 ** 8;
54 pragma Universal_Aliasing (Packed_Byte);
55 for Packed_Byte'Size use 8;
56 -- Component type for Packed_Bytes1, Packed_Bytes2 and Packed_Byte4 arrays.
57 -- As this type is used by the compiler to implement operations on user
58 -- packed array, it needs to be able to alias any type.
60 type Packed_Bytes1 is array (Natural range <>) of aliased Packed_Byte;
61 for Packed_Bytes1'Alignment use 1;
62 for Packed_Bytes1'Component_Size use Packed_Byte'Size;
63 pragma Suppress_Initialization (Packed_Bytes1);
64 -- This is the type used to implement packed arrays where no alignment
65 -- is required. This includes the cases of 1,2,4 (where we use direct
66 -- masking operations), and all odd component sizes (where the clusters
67 -- are not aligned anyway, see, e.g. System.Pack_07 in file s-pack07
68 -- for details.
70 type Packed_Bytes2 is new Packed_Bytes1;
71 for Packed_Bytes2'Alignment use Integer'Min (2, Standard'Maximum_Alignment);
72 pragma Suppress_Initialization (Packed_Bytes2);
73 -- This is the type used to implement packed arrays where an alignment
74 -- of 2 (is possible) is helpful for maximum efficiency of the get and
75 -- set routines in the corresponding library unit. This is true of all
76 -- component sizes that are even but not divisible by 4 (other than 2 for
77 -- which we use direct masking operations). In such cases, the clusters
78 -- can be assumed to be 2-byte aligned if the array is aligned. See for
79 -- example System.Pack_10 in file s-pack10).
81 type Packed_Bytes4 is new Packed_Bytes1;
82 for Packed_Bytes4'Alignment use Integer'Min (4, Standard'Maximum_Alignment);
83 pragma Suppress_Initialization (Packed_Bytes4);
84 -- This is the type used to implement packed arrays where an alignment
85 -- of 4 (if possible) is helpful for maximum efficiency of the get and
86 -- set routines in the corresponding library unit. This is true of all
87 -- component sizes that are divisible by 4 (other than powers of 2, which
88 -- are either handled by direct masking or not packed at all). In such
89 -- cases the clusters can be assumed to be 4-byte aligned if the array
90 -- is aligned (see System.Pack_12 in file s-pack12 as an example).
92 type Bits_1 is mod 2**1;
93 type Bits_2 is mod 2**2;
94 type Bits_4 is mod 2**4;
95 -- Types used for packed array conversions
97 subtype Bytes_F is Packed_Bytes4 (1 .. Float'Size / 8);
98 -- Type used in implementation of Is_Negative intrinsic (see Exp_Intr)
100 function Shift_Left
101 (Value : Short_Short_Unsigned;
102 Amount : Natural) return Short_Short_Unsigned;
104 function Shift_Right
105 (Value : Short_Short_Unsigned;
106 Amount : Natural) return Short_Short_Unsigned;
108 function Shift_Right_Arithmetic
109 (Value : Short_Short_Unsigned;
110 Amount : Natural) return Short_Short_Unsigned;
112 function Rotate_Left
113 (Value : Short_Short_Unsigned;
114 Amount : Natural) return Short_Short_Unsigned;
116 function Rotate_Right
117 (Value : Short_Short_Unsigned;
118 Amount : Natural) return Short_Short_Unsigned;
120 function Shift_Left
121 (Value : Short_Unsigned;
122 Amount : Natural) return Short_Unsigned;
124 function Shift_Right
125 (Value : Short_Unsigned;
126 Amount : Natural) return Short_Unsigned;
128 function Shift_Right_Arithmetic
129 (Value : Short_Unsigned;
130 Amount : Natural) return Short_Unsigned;
132 function Rotate_Left
133 (Value : Short_Unsigned;
134 Amount : Natural) return Short_Unsigned;
136 function Rotate_Right
137 (Value : Short_Unsigned;
138 Amount : Natural) return Short_Unsigned;
140 function Shift_Left
141 (Value : Unsigned;
142 Amount : Natural) return Unsigned;
144 function Shift_Right
145 (Value : Unsigned;
146 Amount : Natural) return Unsigned;
148 function Shift_Right_Arithmetic
149 (Value : Unsigned;
150 Amount : Natural) return Unsigned;
152 function Rotate_Left
153 (Value : Unsigned;
154 Amount : Natural) return Unsigned;
156 function Rotate_Right
157 (Value : Unsigned;
158 Amount : Natural) return Unsigned;
160 function Shift_Left
161 (Value : Long_Unsigned;
162 Amount : Natural) return Long_Unsigned;
164 function Shift_Right
165 (Value : Long_Unsigned;
166 Amount : Natural) return Long_Unsigned;
168 function Shift_Right_Arithmetic
169 (Value : Long_Unsigned;
170 Amount : Natural) return Long_Unsigned;
172 function Rotate_Left
173 (Value : Long_Unsigned;
174 Amount : Natural) return Long_Unsigned;
176 function Rotate_Right
177 (Value : Long_Unsigned;
178 Amount : Natural) return Long_Unsigned;
180 function Shift_Left
181 (Value : Long_Long_Unsigned;
182 Amount : Natural) return Long_Long_Unsigned;
184 function Shift_Right
185 (Value : Long_Long_Unsigned;
186 Amount : Natural) return Long_Long_Unsigned;
188 function Shift_Right_Arithmetic
189 (Value : Long_Long_Unsigned;
190 Amount : Natural) return Long_Long_Unsigned;
192 function Rotate_Left
193 (Value : Long_Long_Unsigned;
194 Amount : Natural) return Long_Long_Unsigned;
196 function Rotate_Right
197 (Value : Long_Long_Unsigned;
198 Amount : Natural) return Long_Long_Unsigned;
200 pragma Import (Intrinsic, Shift_Left);
201 pragma Import (Intrinsic, Shift_Right);
202 pragma Import (Intrinsic, Shift_Right_Arithmetic);
203 pragma Import (Intrinsic, Rotate_Left);
204 pragma Import (Intrinsic, Rotate_Right);
206 -- The following definitions are obsolescent. They were needed by the
207 -- previous version of the compiler and runtime, but are not needed
208 -- by the current version. We retain them to help with bootstrap path
209 -- problems. Also they seem harmless, and if any user programs have
210 -- been using these types, why discombobulate them?
212 subtype Packed_Bytes is Packed_Bytes4;
213 subtype Packed_Bytes_Unaligned is Packed_Bytes1;
215 end System.Unsigned_Types;