File: RM-3-5-4.html

package info (click to toggle)
ada-reference-manual 20021112web-3
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k, lenny, sarge
  • size: 18,652 kB
  • ctags: 8,921
  • sloc: makefile: 52; sh: 20
file content (291 lines) | stat: -rw-r--r-- 21,970 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<HEAD>
    <TITLE>Ada95 - Integer Types</TITLE>
    <META NAME="Author" CONTENT="JTC1/SC22/WG9/ARG, by Randall Brukardt, ARG Editor">
    <META NAME="GENERATOR" CONTENT="Arm_Form.Exe, Ada Reference Manual generator">
    <STYLE type="text/css">
    DIV.paranum {position: absolute; font-family: Arial, Helvetica, sans-serif; left: 0.5 em; top: auto}
    TT {font-family: "Courier New", monospace}
    DT {display: compact}
    DIV.Normal {font-family: "Times New Roman", Times, serif; margin-bottom: 0.6em}
    DIV.Wide {font-family: "Times New Roman", Times, serif; margin-top: 0.6em; margin-bottom: 0.6em}
    DIV.Annotations {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-bottom: 0.6em}
    DIV.WideAnnotations {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-top: 0.6em; margin-bottom: 0.6em}
    DIV.Index {font-family: "Times New Roman", Times, serif}
    DIV.SyntaxSummary {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-bottom: 0.4em}
    DIV.Notes {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-bottom: 0.6em}
    DIV.NotesHeader {font-family: "Times New Roman", Times, serif; margin-left: 2.0em}
    DIV.SyntaxIndented {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-bottom: 0.4em}
    DIV.Indented {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-bottom: 0.6em}
    DIV.CodeIndented {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-bottom: 0.6em}
    DIV.SmallIndented {font-family: "Times New Roman", Times, serif; margin-left:  10.0em; margin-bottom: 0.6em}
    DIV.SmallCodeIndented {font-family: "Times New Roman", Times, serif; margin-left: 8.0em; margin-bottom: 0.6em}
    DIV.Examples {font-family: "Courier New", monospace; margin-left: 2.0em; margin-bottom: 0.6em}
    DIV.SmallExamples {font-family: "Courier New", monospace; font-size: 80%; margin-left: 7.5em; margin-bottom: 0.6em}
    DIV.IndentedExamples {font-family: "Courier New", monospace; margin-left: 8.0em; margin-bottom: 0.6em}
    DIV.SmallIndentedExamples {font-family: "Courier New", monospace; font-size: 80%; margin-left:  15.0em; margin-bottom: 0.6em}
    UL.Bulleted {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-right: 2.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.SmallBulleted {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-right: 6.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.NestedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-right: 4.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.SmallNestedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 8.0em; margin-right: 8.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.IndentedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 8.0em; margin-right: 8.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.CodeIndentedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-right: 6.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.CodeIndentedNestedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 8.0em; margin-right: 8.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.SyntaxIndentedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-right: 4.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.NotesBulleted {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-right: 4.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.NotesNestedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-right: 6.0em; margin-top: 0em; margin-bottom: 0.5em}
    DL.Hanging {font-family: "Times New Roman", Times, serif; margin-top: 0em; margin-bottom: 0.6em}
    DD.Hanging {margin-left: 6.0em}
    DL.IndentedHanging {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-top: 0em; margin-bottom: 0.6em}
    DD.IndentedHanging {margin-left: 2.0em}
    DL.HangingInBulleted {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-right: 2.0em; margin-top: 0em; margin-bottom: 0.5em}
    DD.HangingInBulleted {margin-left: 4.0em}
    DL.SmallHanging {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-top: 0em; margin-bottom: 0.6em}
    DD.SmallHanging {margin-left: 7.5em}
    DL.SmallIndentedHanging {font-family: "Times New Roman", Times, serif; margin-left: 8.0em; margin-top: 0em; margin-bottom: 0.6em}
    DD.SmallIndentedHanging {margin-left: 2.0em}
    DL.SmallHangingInBulleted {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-right: 6.0em; margin-top: 0em; margin-bottom: 0.5em}
    DD.SmallHangingInBulleted {margin-left: 5.0em}
    DL.Enumerated {font-family: "Times New Roman", Times, serif; margin-right: 0.0em; margin-top: 0em; margin-bottom: 0.5em}
    DD.Enumerated {margin-left: 2.0em}
    DL.SmallEnumerated {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-right: 4.0em; margin-top: 0em; margin-bottom: 0.5em}
    DD.SmallEnumerated {margin-left: 2.5em}
    DL.NestedEnumerated {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-right: 2.0em; margin-top: 0em; margin-bottom: 0.5em}
    DL.SmallNestedEnumerated {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-right: 6.0em; margin-top: 0em; margin-bottom: 0.5em}
    </STYLE>
</HEAD>
<BODY TEXT="#000000" BGCOLOR="#FFFFF0" LINK="#0000FF" VLINK="#800080" ALINK="#FF0000">
<P><A HREF="RM-TOC.html">Contents</A>&nbsp;&nbsp;&nbsp;<A HREF="RM-0-29.html">Index</A>&nbsp;&nbsp;&nbsp;<A HREF="RM-3-5-3.html">Previous</A>&nbsp;&nbsp;&nbsp;<A HREF="RM-3-5-5.html">Next</A></P>
<HR>
<H1> 3.5.4 Integer Types</H1>
<DIV Class="Paranum"><FONT SIZE=-2>1</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;<A NAME="I1599"></A><A NAME="I1600"></A><A NAME="I1601"></A>An
<FONT FACE="Arial, Helvetica">integer_type_definition</FONT> defines
an integer type; it defines either a <I>signed</I> integer type, or a
<I>modular</I> integer type. The base range of a signed integer type
includes at least the values of the specified range. A modular type is
an integer type with all arithmetic modulo a specified positive <I>modulus</I>;
such a type corresponds to an unsigned type with wrap-around semantics.
<A NAME="I1602"></A></DIV>

<H4 ALIGN=CENTER>Syntax</H4>
<DIV Class="Paranum"><FONT SIZE=-2>2</FONT></DIV>
<DIV Class="SyntaxIndented"><FONT FACE="Arial, Helvetica">integer_type_definition<A NAME="I1603"></A>
::= </FONT><A NAME="I1604"></A><FONT FACE="Arial, Helvetica">signed_integer_type_definition</FONT>&nbsp;|&nbsp;<A NAME="I1605"></A><FONT FACE="Arial, Helvetica">modular_type_definition</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>3</FONT></DIV>
<DIV Class="SyntaxIndented"><FONT FACE="Arial, Helvetica">signed_integer_type_definition<A NAME="I1606"></A>
::= </FONT><B>range</B>&nbsp;<I>static_</I><A NAME="I1607"></A><FONT FACE="Arial, Helvetica">simple_expression</FONT>&nbsp;..&nbsp;<I>static_</I><A NAME="I1608"></A><FONT FACE="Arial, Helvetica">simple_expression</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>4</FONT></DIV>
<DIV Class="SyntaxIndented"><FONT FACE="Arial, Helvetica">modular_type_definition<A NAME="I1609"></A>
::= </FONT><B>mod</B>&nbsp;<I>static_</I><A NAME="I1610"></A><FONT FACE="Arial, Helvetica">expression</FONT></DIV>

<H4 ALIGN=CENTER>Name Resolution Rules</H4>
<DIV Class="Paranum"><FONT SIZE=-2>5</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;<A NAME="I1611"></A>Each <FONT FACE="Arial, Helvetica">simple_expression</FONT>
in a <FONT FACE="Arial, Helvetica">signed_integer_type_definition</FONT>
is expected to be of any integer type; they need not be of the same type.
<A NAME="I1612"></A>The <FONT FACE="Arial, Helvetica">expression</FONT>
in a <FONT FACE="Arial, Helvetica">modular_type_definition</FONT> is
likewise expected to be of any integer type. </DIV>

<H4 ALIGN=CENTER>Legality Rules</H4>
<DIV Class="Paranum"><FONT SIZE=-2>6</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;The <FONT FACE="Arial, Helvetica">simple_expression</FONT>s
of a <FONT FACE="Arial, Helvetica">signed_integer_type_definition</FONT>
shall be static, and their values shall be in the range System.Min_Int
.. System.Max_Int.</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>7</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;<A NAME="I1613"></A><A NAME="I1614"></A><A NAME="I1615"></A>The
<FONT FACE="Arial, Helvetica">expression</FONT> of a <FONT FACE="Arial, Helvetica">modular_type_definition</FONT>
shall be static, and its value (the <I>modulus</I>) shall be positive,
and shall be no greater than System.Max_Binary_Modulus if a power of
2, or no greater than System.Max_Nonbinary_Modulus if not. </DIV>

<H4 ALIGN=CENTER>Static Semantics</H4>
<DIV Class="Paranum"><FONT SIZE=-2>8</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;The set of values for a signed integer type is
the (infinite) set of mathematical integers, though only values of the
base range of the type are fully supported for run-time operations. The
set of values for a modular integer type are the values from 0 to one
less than the modulus, inclusive.</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>9</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;<A NAME="I1616"></A>A <FONT FACE="Arial, Helvetica">signed_integer_type_definition</FONT>
defines an integer type whose base range includes at least the values
of the <FONT FACE="Arial, Helvetica">simple_expression</FONT>s and is
symmetric about zero, excepting possibly an extra negative value. <A NAME="I1617"></A><A NAME="I1618"></A>A
<FONT FACE="Arial, Helvetica">signed_integer_type_definition</FONT> also
defines a constrained first subtype of the type, with a range whose bounds
are given by the values of the <FONT FACE="Arial, Helvetica">simple_expression</FONT>s,
converted to the type being defined. </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>10</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;&nbsp;<A NAME="I1619"></A>A <FONT FACE="Arial, Helvetica">modular_type_definition</FONT>
defines a modular type whose base range is from zero to one less than
the given modulus. <A NAME="I1620"></A><A NAME="I1621"></A>A <FONT FACE="Arial, Helvetica">modular_type_definition</FONT>
also defines a constrained first subtype of the type with a range that
is the same as the base range of the type.</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>11</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;&nbsp;<A NAME="I1622"></A>There is a predefined signed
integer subtype named Integer, declared in the visible part of package
Standard. It is constrained to the base range of its type. </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>12</FONT></DIV>
<DIV Class="Normal" Style="margin-bottom: 0.4em">&nbsp;&nbsp;&nbsp;&nbsp;<A NAME="I1623"></A><A NAME="I1624"></A>Integer
has two predefined subtypes, declared in the visible part of package
Standard: </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>13</FONT></DIV>
<DIV Class="Examples"><TT><B>subtype</B>&nbsp;Natural&nbsp;&nbsp;<B>is</B>&nbsp;Integer&nbsp;<B>range</B>&nbsp;0&nbsp;..&nbsp;Integer'Last;<BR>
<B>subtype</B>&nbsp;Positive&nbsp;<B>is</B>&nbsp;Integer&nbsp;<B>range</B>&nbsp;1&nbsp;..&nbsp;Integer'Last;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>14</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;&nbsp;<A NAME="I1625"></A><A NAME="I1626"></A><A NAME="I1627"></A>A
type defined by an <FONT FACE="Arial, Helvetica">integer_type_definition</FONT>
is implicitly derived from <I>root_integer</I>, an anonymous predefined
(specific) integer type, whose base range is System.Min_Int .. System.Max_Int.
However, the base range of the new type is not inherited from <I>root_integer</I>,
but is instead determined by the range or modulus specified by the <FONT FACE="Arial, Helvetica">integer_type_definition</FONT>.
<A NAME="I1628"></A><A NAME="I1629"></A>Integer literals are all of the
type <I>universal_integer</I>, the universal type (see <A HREF="RM-3-4-1.html">3.4.1</A>)
for the class rooted at <I>root_integer</I>, allowing their use with
the operations of any integer type. </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>15</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;&nbsp;<A NAME="I1630"></A>The <I>position number</I>
of an integer value is equal to the value.</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>16</FONT></DIV>
<DIV Class="Wide" Style="margin-bottom: 0.4em">&nbsp;&nbsp;&nbsp;&nbsp;For every modular
subtype S, the following attribute is defined: </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>17</FONT></DIV>
<DL Class="Hanging"><DT>&nbsp;&nbsp;&nbsp;&nbsp;S'Modulus<DD Class="Hanging">
<A NAME="I1631"></A><A NAME="I1632"></A>S'Modulus yields the modulus
of the type of S, as a value of the type <I>universal_integer</I>. </DL>

<H4 ALIGN=CENTER>Dynamic Semantics</H4>
<DIV Class="Paranum"><FONT SIZE=-2>18</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;&nbsp;<A NAME="I1633"></A>The elaboration of an <FONT FACE="Arial, Helvetica">integer_type_definition</FONT>
creates the integer type and its first subtype.</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>19</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;&nbsp;For a modular type, if the result of the execution
of a predefined operator (see <A HREF="RM-4-5.html">4.5</A>) is outside
the base range of the type, the result is reduced modulo the modulus
of the type to a value that is within the base range of the type.</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>20</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;&nbsp;<A NAME="I1634"></A><A NAME="I1635"></A><A NAME="I1636"></A>For
a signed integer type, the exception Constraint_Error is raised by the
execution of an operation that cannot deliver the correct result because
it is outside the base range of the type. <A NAME="I1637"></A><A NAME="I1638"></A><A NAME="I1639"></A>For
any integer type, Constraint_Error is raised by the operators &quot;/&quot;,
&quot;<B>rem</B>&quot;, and &quot;<B>mod</B>&quot; if the right operand
is zero.</DIV>

<H4 ALIGN=CENTER>Implementation Requirements</H4>
<DIV Class="Paranum"><FONT SIZE=-2>21</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;&nbsp;<A NAME="I1640"></A>In an implementation, the
range of Integer shall include the range -2**15+1 .. +2**15-1.</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>22</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;&nbsp;<A NAME="I1641"></A>If Long_Integer is predefined
for an implementation, then its range shall include the range -2**31+1
.. +2**31-1.</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>23</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;&nbsp;System.Max_Binary_Modulus shall be at least 2**16.
</DIV>

<H4 ALIGN=CENTER>Implementation Permissions</H4>
<DIV Class="Paranum"><FONT SIZE=-2>24</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;&nbsp;For the execution of a predefined operation of
a signed integer type, the implementation need not raise Constraint_Error
if the result is outside the base range of the type, so long as the correct
result is produced. </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>25</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;&nbsp;<A NAME="I1642"></A><A NAME="I1643"></A>An implementation
may provide additional predefined signed integer types, declared in the
visible part of Standard, whose first subtypes have names of the form
Short_Integer, Long_Integer, Short_Short_Integer, Long_Long_Integer,
etc. Different predefined integer types are allowed to have the same
base range. However, the range of Integer should be no wider than that
of Long_Integer. Similarly, the range of Short_Integer (if provided)
should be no wider than Integer. Corresponding recommendations apply
to any other predefined integer types. There need not be a named integer
type corresponding to each distinct base range supported by an implementation.
The range of each first subtype should be the base range of its type.
</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>26</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;&nbsp;<A NAME="I1644"></A>An implementation may provide
<I>nonstandard integer types</I>, descendants of <I>root_integer</I>
that are declared outside of the specification of package Standard, which
need not have all the standard characteristics of a type defined by an
<FONT FACE="Arial, Helvetica">integer_type_definition</FONT>. For example,
a nonstandard integer type might have an asymmetric base range or it
might not be allowed as an array or loop index (a very long integer).
Any type descended from a nonstandard integer type is also nonstandard.
An implementation may place arbitrary restrictions on the use of such
types; it is implementation defined whether operators that are predefined
for ``any integer type'' are defined for a particular nonstandard integer
type. In any case, such types are not permitted as <FONT FACE="Arial, Helvetica">explicit_generic_actual_parameter</FONT>s
for formal scalar types -- see <A HREF="RM-12-5-2.html">12.5.2</A>. </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>27</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;&nbsp;<A NAME="I1645"></A>For a one's complement machine,
the high bound of the base range of a modular type whose modulus is one
less than a power of 2 may be equal to the modulus, rather than one less
than the modulus. It is implementation defined for which powers of 2,
if any, this permission is exercised.</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>27.1/1</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;For a one's complement machine, implementations
may support non-binary modulus values greater than System.Max_Nonbinary_Modulus.
It is implementation defined which specific values greater than System.Max_Nonbinary_Modulus,
if any, are supported. </DIV>

<H4 ALIGN=CENTER>Implementation Advice</H4>
<DIV Class="Paranum"><FONT SIZE=-2>28</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;&nbsp;<A NAME="I1646"></A>An implementation should
support Long_Integer in addition to Integer if the target machine supports
32-bit (or longer) arithmetic. No other named integer subtypes are recommended
for package Standard. Instead, appropriate named integer subtypes should
be provided in the library package Interfaces (see <A HREF="RM-B-2.html">B.2</A>).
</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>29</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;&nbsp;<A NAME="I1647"></A>An implementation for a two's
complement machine should support modular types with a binary modulus
up to System.Max_Int*2+2. An implementation should support a nonbinary
modulus up to Integer'Last. </DIV>
<DIV Class="NotesHeader"><FONT SIZE=-1>NOTES</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>30</FONT></DIV>
<DIV Class="Notes"><FONT SIZE=-1>25&nbsp;&nbsp;<A NAME="I1648"></A><A NAME="I1649"></A>Integer
literals are of the anonymous predefined integer type <I>universal_integer</I>.
Other integer types have no literals. However, the overload resolution
rules (see <A HREF="RM-8-6.html">8.6</A>, ``<A HREF="RM-8-6.html">The
Context of Overload Resolution</A>'') allow expressions of the type <I>universal_integer</I>
whenever an integer type is expected.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>31</FONT></DIV>
<DIV Class="Notes"><FONT SIZE=-1>26&nbsp;&nbsp;The same arithmetic operators
are predefined for all signed integer types defined by a <FONT FACE="Arial, Helvetica">signed_integer_type_definition</FONT>
(see <A HREF="RM-4-5.html">4.5</A>, ``<A HREF="RM-4-5.html">Operators
and Expression Evaluation</A>''). For modular types, these same operators
are predefined, plus bit-wise logical operators (<B>and</B>, <B>or</B>,
<B>xor</B>, and <B>not</B>). In addition, for the unsigned types declared
in the language-defined package Interfaces (see <A HREF="RM-B-2.html">B.2</A>),
functions are defined that provide bit-wise shifting and rotating.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>32</FONT></DIV>
<DIV Class="Notes"><FONT SIZE=-1>27&nbsp;&nbsp;Modular types match a
<FONT FACE="Arial, Helvetica">generic_formal_parameter_declaration</FONT>
of the form &quot;<B>type</B> T <B>is mod</B> &lt;&gt;;&quot;; signed
integer types match &quot;<B>type</B> T <B>is range</B> &lt;&gt;;&quot;
(see <A HREF="RM-12-5-2.html">12.5.2</A>). </FONT></DIV>

<H4 ALIGN=CENTER>Examples</H4>
<DIV Class="Paranum"><FONT SIZE=-2>33</FONT></DIV>
<DIV Class="Normal" Style="margin-bottom: 0.4em">&nbsp;&nbsp;&nbsp;&nbsp;<I>Examples of
integer types and subtypes: </I></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>34</FONT></DIV>
<DIV Class="Examples"><TT><B>type</B>&nbsp;Page_Num&nbsp;&nbsp;<B>is</B>&nbsp;<B>range</B>&nbsp;1&nbsp;..&nbsp;2_000;<BR>
<B>type</B>&nbsp;Line_Size&nbsp;<B>is</B>&nbsp;<B>range</B>&nbsp;1&nbsp;..&nbsp;Max_Line_Size;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>35</FONT></DIV>
<DIV Class="Examples"><TT><B>subtype</B>&nbsp;Small_Int&nbsp;&nbsp;&nbsp;<B>is</B>&nbsp;Integer&nbsp;&nbsp;&nbsp;<B>range</B>&nbsp;-10&nbsp;..&nbsp;10;<BR>
<B>subtype</B>&nbsp;Column_Ptr&nbsp;&nbsp;<B>is</B>&nbsp;Line_Size&nbsp;<B>range</B>&nbsp;1&nbsp;..&nbsp;10;<BR>
<B>subtype</B>&nbsp;Buffer_Size&nbsp;<B>is</B>&nbsp;Integer&nbsp;&nbsp;&nbsp;<B>range</B>&nbsp;0&nbsp;..&nbsp;Max;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>36</FONT></DIV>
<DIV Class="Examples"><TT><B>type</B>&nbsp;Byte&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>is</B>&nbsp;<B>mod</B>&nbsp;256;&nbsp;<I>--&nbsp;an&nbsp;unsigned&nbsp;byte</I><BR>
<B>type</B>&nbsp;Hash_Index&nbsp;&nbsp;<B>is</B>&nbsp;<B>mod</B>&nbsp;97;&nbsp;&nbsp;<I>--&nbsp;modulus&nbsp;is&nbsp;prime</I></TT></DIV>

<HR>
<P><A HREF="RM-TOC.html">Contents</A>&nbsp;&nbsp;&nbsp;<A HREF="RM-0-29.html">Index</A>&nbsp;&nbsp;&nbsp;<A HREF="RM-3-5-3.html">Previous</A>&nbsp;&nbsp;&nbsp;<A HREF="RM-3-5-5.html">Next</A>&nbsp;&nbsp;&nbsp;<A HREF="RM-TTL.html">Legal</A></P>
</BODY>
</HTML>