1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
5 -- S Y S T E M . S T O R A G E _ E L E M E N T S --
10 -- This specification is adapted from the Ada Reference Manual for use with --
11 -- GNAT. In accordance with the copyright of that document, you can freely --
12 -- copy and modify this specification, provided that if you redistribute a --
13 -- modified version, any changes that you have made are clearly indicated. --
15 ------------------------------------------------------------------------------
17 -- Warning: declarations in this package are ambiguous with respect to the
18 -- extra declarations that can be introduced into System using Extend_System.
19 -- It is a good idea to avoid use clauses for this package!
21 pragma Warnings
(Off
);
22 -- This is to stop bootstrap problems with the use of Inline_Always
23 -- To be removed (along with redundant Inline pragmas) in 3.13.
25 package System
.Storage_Elements
is
26 pragma Pure
(Storage_Elements
);
27 -- Note that we take advantage of the implementation permission to make
28 -- this unit Pure instead of Preelaborable; see RM 13.7.1(15).
30 type Storage_Offset
is range
31 -(2 ** (Standard
."-" (Standard
'Address_Size, 1))) ..
32 +(2 ** (Standard
."-" (Standard
'Address_Size, 1))) - 1;
33 -- Note: the reason for the qualification of "-" here by Standard is
34 -- that we have a current bug in GNAT that otherwise causes a bogus
35 -- ambiguity when this unit is analyzed in an Rtsfind context.
37 subtype Storage_Count
is Storage_Offset
range 0 .. Storage_Offset
'Last;
39 type Storage_Element
is mod 2 ** Storage_Unit
;
40 for Storage_Element
'Size use Storage_Unit
;
43 array (Storage_Offset
range <>) of aliased Storage_Element
;
44 for Storage_Array
'Component_Size use Storage_Unit
;
48 function "+" (Left
: Address
; Right
: Storage_Offset
) return Address
;
49 pragma Convention
(Intrinsic
, "+");
51 pragma Inline_Always
("+");
53 function "+" (Left
: Storage_Offset
; Right
: Address
) return Address
;
54 pragma Convention
(Intrinsic
, "+");
56 pragma Inline_Always
("+");
58 function "-" (Left
: Address
; Right
: Storage_Offset
) return Address
;
59 pragma Convention
(Intrinsic
, "-");
61 pragma Inline_Always
("-");
63 function "-" (Left
, Right
: Address
) return Storage_Offset
;
64 pragma Convention
(Intrinsic
, "-");
66 pragma Inline_Always
("-");
70 Right
: Storage_Offset
)
71 return Storage_Offset
;
72 pragma Convention
(Intrinsic
, "mod");
73 pragma Inline
("mod");
74 pragma Inline_Always
("mod");
76 -- Conversion to/from integers
78 type Integer_Address
is mod Memory_Size
;
80 function To_Address
(Value
: Integer_Address
) return Address
;
81 pragma Convention
(Intrinsic
, To_Address
);
82 pragma Inline
(To_Address
);
83 pragma Inline_Always
(To_Address
);
85 function To_Integer
(Value
: Address
) return Integer_Address
;
86 pragma Convention
(Intrinsic
, To_Integer
);
87 pragma Inline
(To_Integer
);
88 pragma Inline_Always
(To_Integer
);
90 end System
.Storage_Elements
;