* sh.h (REG_CLASS_FROM_LETTER): Change to:
[official-gcc.git] / gcc / ada / s-unstyp.ads
blob7ed1033553c268817fbc639a227e0426edc08189
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT RUNTIME 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-2001 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 2, 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. See the GNU General Public License --
17 -- for more details. You should have received a copy of the GNU General --
18 -- Public License distributed with GNAT; see file COPYING. If not, write --
19 -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
20 -- MA 02111-1307, USA. --
21 -- --
22 -- As a special exception, if other files instantiate generics from this --
23 -- unit, or you link this unit with other files to produce an executable, --
24 -- this unit does not by itself cause the resulting executable to be --
25 -- covered by the GNU General Public License. This exception does not --
26 -- however invalidate any other reasons why the executable file might be --
27 -- covered by the GNU Public License. --
28 -- --
29 -- GNAT was originally developed by the GNAT team at New York University. --
30 -- Extensive contributions were provided by Ada Core Technologies Inc. --
31 -- --
32 ------------------------------------------------------------------------------
34 -- This package contains definitions of standard unsigned types that
35 -- correspond in size to the standard signed types declared in Standard.
36 -- and (unlike the types in Interfaces have corresponding names). It
37 -- also contains some related definitions for other specialized types
38 -- used by the compiler in connection with packed array types.
40 package System.Unsigned_Types is
41 pragma Pure (Unsigned_Types);
43 type Short_Short_Unsigned is mod 2 ** Short_Short_Integer'Size;
44 type Short_Unsigned is mod 2 ** Short_Integer'Size;
45 type Unsigned is mod 2 ** Integer'Size;
46 type Long_Unsigned is mod 2 ** Long_Integer'Size;
47 type Long_Long_Unsigned is mod 2 ** Long_Long_Integer'Size;
49 type Float_Unsigned is mod 2 ** Float'Size;
50 -- Used in the implementation of Is_Negative intrinsic (see Exp_Intr)
52 type Packed_Byte is mod 2 ** 8;
53 for Packed_Byte'Size use 8;
54 -- Component type for Packed_Butes array
56 type Packed_Bytes1 is array (Natural range <>) of Packed_Byte;
57 for Packed_Bytes1'Alignment use 1;
58 -- This is the type used to implement packed arrays where no alignment
59 -- is required. This includes the cases of 1,2,4 (where we use direct
60 -- masking operations), and all odd component sizes (where the clusters
61 -- are not aligned anyway, see, e.g. System.Pack_07 in file s-pack07
62 -- for details.
64 type Packed_Bytes2 is new Packed_Bytes1;
65 for Packed_Bytes2'Alignment use 2;
66 -- This is the type used to implement packed arrays where an alignment
67 -- of 2 is helpful for maximum efficiency of the get and set routines
68 -- in the corresponding library unit. This is true of all component
69 -- sizes that are even but not divisible by 4 (other than 2 for which
70 -- we use direct masking operations). In such cases, the clusters can
71 -- be assumed to be 2-byte aligned if the array is aligned. See for
72 -- example System.Pack_10 in file s-pack10).
74 type Packed_Bytes4 is new Packed_Bytes1;
75 for Packed_Bytes4'Alignment use Integer'Min (4, Standard'Maximum_Alignment);
76 -- This is the type used to implement packed arrays where an alignment
77 -- of 4 is helpful for maximum efficiency of the get and set routines
78 -- in the corresponding library unit. This is true of all component
79 -- sizes that are divisible by 4 (other than powers of 2, which are
80 -- either handled by direct masking or not packed at all). In such cases
81 -- the clusters can be assumed to be 4-byte aligned if the array is
82 -- aligned (see System.Pack_12 in file s-pack12 as an example).
84 type Bits_1 is mod 2**1;
85 type Bits_2 is mod 2**2;
86 type Bits_4 is mod 2**4;
87 -- Types used for packed array conversions
89 subtype Bytes_F is Packed_Bytes4 (1 .. Float'Size / 8);
90 -- Type used in implementation of Is_Negative instrinsic (see Exp_Intr)
92 function Shift_Left
93 (Value : Short_Short_Unsigned;
94 Amount : Natural)
95 return Short_Short_Unsigned;
97 function Shift_Right
98 (Value : Short_Short_Unsigned;
99 Amount : Natural)
100 return Short_Short_Unsigned;
102 function Shift_Right_Arithmetic
103 (Value : Short_Short_Unsigned;
104 Amount : Natural)
105 return Short_Short_Unsigned;
107 function Rotate_Left
108 (Value : Short_Short_Unsigned;
109 Amount : Natural)
110 return Short_Short_Unsigned;
112 function Rotate_Right
113 (Value : Short_Short_Unsigned;
114 Amount : Natural)
115 return Short_Short_Unsigned;
117 function Shift_Left
118 (Value : Short_Unsigned;
119 Amount : Natural)
120 return Short_Unsigned;
122 function Shift_Right
123 (Value : Short_Unsigned;
124 Amount : Natural)
125 return Short_Unsigned;
127 function Shift_Right_Arithmetic
128 (Value : Short_Unsigned;
129 Amount : Natural)
130 return Short_Unsigned;
132 function Rotate_Left
133 (Value : Short_Unsigned;
134 Amount : Natural)
135 return Short_Unsigned;
137 function Rotate_Right
138 (Value : Short_Unsigned;
139 Amount : Natural)
140 return Short_Unsigned;
142 function Shift_Left
143 (Value : Unsigned;
144 Amount : Natural)
145 return Unsigned;
147 function Shift_Right
148 (Value : Unsigned;
149 Amount : Natural)
150 return Unsigned;
152 function Shift_Right_Arithmetic
153 (Value : Unsigned;
154 Amount : Natural)
155 return Unsigned;
157 function Rotate_Left
158 (Value : Unsigned;
159 Amount : Natural)
160 return Unsigned;
162 function Rotate_Right
163 (Value : Unsigned;
164 Amount : Natural)
165 return Unsigned;
167 function Shift_Left
168 (Value : Long_Unsigned;
169 Amount : Natural)
170 return Long_Unsigned;
172 function Shift_Right
173 (Value : Long_Unsigned;
174 Amount : Natural)
175 return Long_Unsigned;
177 function Shift_Right_Arithmetic
178 (Value : Long_Unsigned;
179 Amount : Natural)
180 return Long_Unsigned;
182 function Rotate_Left
183 (Value : Long_Unsigned;
184 Amount : Natural)
185 return Long_Unsigned;
187 function Rotate_Right
188 (Value : Long_Unsigned;
189 Amount : Natural)
190 return Long_Unsigned;
192 function Shift_Left
193 (Value : Long_Long_Unsigned;
194 Amount : Natural)
195 return Long_Long_Unsigned;
197 function Shift_Right
198 (Value : Long_Long_Unsigned;
199 Amount : Natural)
200 return Long_Long_Unsigned;
202 function Shift_Right_Arithmetic
203 (Value : Long_Long_Unsigned;
204 Amount : Natural)
205 return Long_Long_Unsigned;
207 function Rotate_Left
208 (Value : Long_Long_Unsigned;
209 Amount : Natural)
210 return Long_Long_Unsigned;
212 function Rotate_Right
213 (Value : Long_Long_Unsigned;
214 Amount : Natural)
215 return Long_Long_Unsigned;
217 pragma Import (Intrinsic, Shift_Left);
218 pragma Import (Intrinsic, Shift_Right);
219 pragma Import (Intrinsic, Shift_Right_Arithmetic);
220 pragma Import (Intrinsic, Rotate_Left);
221 pragma Import (Intrinsic, Rotate_Right);
223 -- The following definitions are obsolsecent. They were needed by the
224 -- previous version of the compiler and runtime, but are not needed
225 -- by the current version. We retain them to help with bootstrap path
226 -- problems. Also they seem harmless, and if any user programs have
227 -- been (rather improperly) using these types, why discombobulate them?
229 subtype Packed_Bytes is Packed_Bytes4;
230 subtype Packed_Bytes_Unaligned is Packed_Bytes1;
232 end System.Unsigned_Types;