1 |
706 |
jeremybenn |
------------------------------------------------------------------------------
|
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-2009, 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 |
|
|
------------------------------------------------------------------------------
|
31 |
|
|
|
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.
|
37 |
|
|
|
38 |
|
|
pragma Warnings (Off);
|
39 |
|
|
pragma Compiler_Unit;
|
40 |
|
|
pragma Warnings (On);
|
41 |
|
|
|
42 |
|
|
package System.Unsigned_Types is
|
43 |
|
|
pragma Pure;
|
44 |
|
|
|
45 |
|
|
type Short_Short_Unsigned is mod 2 ** Short_Short_Integer'Size;
|
46 |
|
|
type Short_Unsigned is mod 2 ** Short_Integer'Size;
|
47 |
|
|
type Unsigned is mod 2 ** Integer'Size;
|
48 |
|
|
type Long_Unsigned is mod 2 ** Long_Integer'Size;
|
49 |
|
|
type Long_Long_Unsigned is mod 2 ** Long_Long_Integer'Size;
|
50 |
|
|
|
51 |
|
|
type Float_Unsigned is mod 2 ** Float'Size;
|
52 |
|
|
-- Used in the implementation of Is_Negative intrinsic (see Exp_Intr)
|
53 |
|
|
|
54 |
|
|
type Packed_Byte is mod 2 ** 8;
|
55 |
|
|
for Packed_Byte'Size use 8;
|
56 |
|
|
-- Component type for Packed_Bytes array
|
57 |
|
|
|
58 |
|
|
type Packed_Bytes1 is array (Natural range <>) of Packed_Byte;
|
59 |
|
|
for Packed_Bytes1'Alignment use 1;
|
60 |
|
|
for Packed_Bytes1'Component_Size use Packed_Byte'Size;
|
61 |
|
|
-- This is the type used to implement packed arrays where no alignment
|
62 |
|
|
-- is required. This includes the cases of 1,2,4 (where we use direct
|
63 |
|
|
-- masking operations), and all odd component sizes (where the clusters
|
64 |
|
|
-- are not aligned anyway, see, e.g. System.Pack_07 in file s-pack07
|
65 |
|
|
-- for details.
|
66 |
|
|
|
67 |
|
|
type Packed_Bytes2 is new Packed_Bytes1;
|
68 |
|
|
for Packed_Bytes2'Alignment use Integer'Min (2, Standard'Maximum_Alignment);
|
69 |
|
|
-- This is the type used to implement packed arrays where an alignment
|
70 |
|
|
-- of 2 (is possible) is helpful for maximum efficiency of the get and
|
71 |
|
|
-- set routines in the corresponding library unit. This is true of all
|
72 |
|
|
-- component sizes that are even but not divisible by 4 (other than 2 for
|
73 |
|
|
-- which we use direct masking operations). In such cases, the clusters
|
74 |
|
|
-- can be assumed to be 2-byte aligned if the array is aligned. See for
|
75 |
|
|
-- example System.Pack_10 in file s-pack10).
|
76 |
|
|
|
77 |
|
|
type Packed_Bytes4 is new Packed_Bytes1;
|
78 |
|
|
for Packed_Bytes4'Alignment use Integer'Min (4, Standard'Maximum_Alignment);
|
79 |
|
|
-- This is the type used to implement packed arrays where an alignment
|
80 |
|
|
-- of 4 (if possible) is helpful for maximum efficiency of the get and
|
81 |
|
|
-- set routines in the corresponding library unit. This is true of all
|
82 |
|
|
-- component sizes that are divisible by 4 (other than powers of 2, which
|
83 |
|
|
-- are either handled by direct masking or not packed at all). In such
|
84 |
|
|
-- cases the clusters can be assumed to be 4-byte aligned if the array
|
85 |
|
|
-- is aligned (see System.Pack_12 in file s-pack12 as an example).
|
86 |
|
|
|
87 |
|
|
type Bits_1 is mod 2**1;
|
88 |
|
|
type Bits_2 is mod 2**2;
|
89 |
|
|
type Bits_4 is mod 2**4;
|
90 |
|
|
-- Types used for packed array conversions
|
91 |
|
|
|
92 |
|
|
subtype Bytes_F is Packed_Bytes4 (1 .. Float'Size / 8);
|
93 |
|
|
-- Type used in implementation of Is_Negative intrinsic (see Exp_Intr)
|
94 |
|
|
|
95 |
|
|
function Shift_Left
|
96 |
|
|
(Value : Short_Short_Unsigned;
|
97 |
|
|
Amount : Natural) return Short_Short_Unsigned;
|
98 |
|
|
|
99 |
|
|
function Shift_Right
|
100 |
|
|
(Value : Short_Short_Unsigned;
|
101 |
|
|
Amount : Natural) return Short_Short_Unsigned;
|
102 |
|
|
|
103 |
|
|
function Shift_Right_Arithmetic
|
104 |
|
|
(Value : Short_Short_Unsigned;
|
105 |
|
|
Amount : Natural) return Short_Short_Unsigned;
|
106 |
|
|
|
107 |
|
|
function Rotate_Left
|
108 |
|
|
(Value : Short_Short_Unsigned;
|
109 |
|
|
Amount : Natural) return Short_Short_Unsigned;
|
110 |
|
|
|
111 |
|
|
function Rotate_Right
|
112 |
|
|
(Value : Short_Short_Unsigned;
|
113 |
|
|
Amount : Natural) return Short_Short_Unsigned;
|
114 |
|
|
|
115 |
|
|
function Shift_Left
|
116 |
|
|
(Value : Short_Unsigned;
|
117 |
|
|
Amount : Natural) return Short_Unsigned;
|
118 |
|
|
|
119 |
|
|
function Shift_Right
|
120 |
|
|
(Value : Short_Unsigned;
|
121 |
|
|
Amount : Natural) return Short_Unsigned;
|
122 |
|
|
|
123 |
|
|
function Shift_Right_Arithmetic
|
124 |
|
|
(Value : Short_Unsigned;
|
125 |
|
|
Amount : Natural) return Short_Unsigned;
|
126 |
|
|
|
127 |
|
|
function Rotate_Left
|
128 |
|
|
(Value : Short_Unsigned;
|
129 |
|
|
Amount : Natural) return Short_Unsigned;
|
130 |
|
|
|
131 |
|
|
function Rotate_Right
|
132 |
|
|
(Value : Short_Unsigned;
|
133 |
|
|
Amount : Natural) return Short_Unsigned;
|
134 |
|
|
|
135 |
|
|
function Shift_Left
|
136 |
|
|
(Value : Unsigned;
|
137 |
|
|
Amount : Natural) return Unsigned;
|
138 |
|
|
|
139 |
|
|
function Shift_Right
|
140 |
|
|
(Value : Unsigned;
|
141 |
|
|
Amount : Natural) return Unsigned;
|
142 |
|
|
|
143 |
|
|
function Shift_Right_Arithmetic
|
144 |
|
|
(Value : Unsigned;
|
145 |
|
|
Amount : Natural) return Unsigned;
|
146 |
|
|
|
147 |
|
|
function Rotate_Left
|
148 |
|
|
(Value : Unsigned;
|
149 |
|
|
Amount : Natural) return Unsigned;
|
150 |
|
|
|
151 |
|
|
function Rotate_Right
|
152 |
|
|
(Value : Unsigned;
|
153 |
|
|
Amount : Natural) return Unsigned;
|
154 |
|
|
|
155 |
|
|
function Shift_Left
|
156 |
|
|
(Value : Long_Unsigned;
|
157 |
|
|
Amount : Natural) return Long_Unsigned;
|
158 |
|
|
|
159 |
|
|
function Shift_Right
|
160 |
|
|
(Value : Long_Unsigned;
|
161 |
|
|
Amount : Natural) return Long_Unsigned;
|
162 |
|
|
|
163 |
|
|
function Shift_Right_Arithmetic
|
164 |
|
|
(Value : Long_Unsigned;
|
165 |
|
|
Amount : Natural) return Long_Unsigned;
|
166 |
|
|
|
167 |
|
|
function Rotate_Left
|
168 |
|
|
(Value : Long_Unsigned;
|
169 |
|
|
Amount : Natural) return Long_Unsigned;
|
170 |
|
|
|
171 |
|
|
function Rotate_Right
|
172 |
|
|
(Value : Long_Unsigned;
|
173 |
|
|
Amount : Natural) return Long_Unsigned;
|
174 |
|
|
|
175 |
|
|
function Shift_Left
|
176 |
|
|
(Value : Long_Long_Unsigned;
|
177 |
|
|
Amount : Natural) return Long_Long_Unsigned;
|
178 |
|
|
|
179 |
|
|
function Shift_Right
|
180 |
|
|
(Value : Long_Long_Unsigned;
|
181 |
|
|
Amount : Natural) return Long_Long_Unsigned;
|
182 |
|
|
|
183 |
|
|
function Shift_Right_Arithmetic
|
184 |
|
|
(Value : Long_Long_Unsigned;
|
185 |
|
|
Amount : Natural) return Long_Long_Unsigned;
|
186 |
|
|
|
187 |
|
|
function Rotate_Left
|
188 |
|
|
(Value : Long_Long_Unsigned;
|
189 |
|
|
Amount : Natural) return Long_Long_Unsigned;
|
190 |
|
|
|
191 |
|
|
function Rotate_Right
|
192 |
|
|
(Value : Long_Long_Unsigned;
|
193 |
|
|
Amount : Natural) return Long_Long_Unsigned;
|
194 |
|
|
|
195 |
|
|
pragma Import (Intrinsic, Shift_Left);
|
196 |
|
|
pragma Import (Intrinsic, Shift_Right);
|
197 |
|
|
pragma Import (Intrinsic, Shift_Right_Arithmetic);
|
198 |
|
|
pragma Import (Intrinsic, Rotate_Left);
|
199 |
|
|
pragma Import (Intrinsic, Rotate_Right);
|
200 |
|
|
|
201 |
|
|
-- The following definitions are obsolescent. They were needed by the
|
202 |
|
|
-- previous version of the compiler and runtime, but are not needed
|
203 |
|
|
-- by the current version. We retain them to help with bootstrap path
|
204 |
|
|
-- problems. Also they seem harmless, and if any user programs have
|
205 |
|
|
-- been (rather improperly) using these types, why discombobulate them?
|
206 |
|
|
|
207 |
|
|
subtype Packed_Bytes is Packed_Bytes4;
|
208 |
|
|
subtype Packed_Bytes_Unaligned is Packed_Bytes1;
|
209 |
|
|
|
210 |
|
|
end System.Unsigned_Types;
|