annotate gcc/ada/libgnat/s-addope.ads @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children 84e7813d76e9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 ------------------------------------------------------------------------------
kono
parents:
diff changeset
2 -- --
kono
parents:
diff changeset
3 -- GNAT COMPILER COMPONENTS --
kono
parents:
diff changeset
4 -- --
kono
parents:
diff changeset
5 -- S Y S T E M . A D D R E S S _ O P E R A T I O N S --
kono
parents:
diff changeset
6 -- --
kono
parents:
diff changeset
7 -- S p e c --
kono
parents:
diff changeset
8 -- --
kono
parents:
diff changeset
9 -- Copyright (C) 2004-2017, Free Software Foundation, Inc. --
kono
parents:
diff changeset
10 -- --
kono
parents:
diff changeset
11 -- GNAT is free software; you can redistribute it and/or modify it under --
kono
parents:
diff changeset
12 -- terms of the GNU General Public License as published by the Free Soft- --
kono
parents:
diff changeset
13 -- ware Foundation; either version 3, or (at your option) any later ver- --
kono
parents:
diff changeset
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
kono
parents:
diff changeset
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
kono
parents:
diff changeset
16 -- or FITNESS FOR A PARTICULAR PURPOSE. --
kono
parents:
diff changeset
17 -- --
kono
parents:
diff changeset
18 -- As a special exception under Section 7 of GPL version 3, you are granted --
kono
parents:
diff changeset
19 -- additional permissions described in the GCC Runtime Library Exception, --
kono
parents:
diff changeset
20 -- version 3.1, as published by the Free Software Foundation. --
kono
parents:
diff changeset
21 -- --
kono
parents:
diff changeset
22 -- You should have received a copy of the GNU General Public License and --
kono
parents:
diff changeset
23 -- a copy of the GCC Runtime Library Exception along with this program; --
kono
parents:
diff changeset
24 -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
kono
parents:
diff changeset
25 -- <http://www.gnu.org/licenses/>. --
kono
parents:
diff changeset
26 -- --
kono
parents:
diff changeset
27 -- GNAT was originally developed by the GNAT team at New York University. --
kono
parents:
diff changeset
28 -- Extensive contributions were provided by Ada Core Technologies Inc. --
kono
parents:
diff changeset
29 -- --
kono
parents:
diff changeset
30 ------------------------------------------------------------------------------
kono
parents:
diff changeset
31
kono
parents:
diff changeset
32 -- This package provides arithmetic and logical operations on type Address.
kono
parents:
diff changeset
33 -- It is intended for use by other packages in the System hierarchy. For
kono
parents:
diff changeset
34 -- applications requiring this capability, see System.Storage_Elements or
kono
parents:
diff changeset
35 -- the operations introduced in System.Aux_DEC;
kono
parents:
diff changeset
36
kono
parents:
diff changeset
37 -- The reason we need this package is that arithmetic operations may not
kono
parents:
diff changeset
38 -- be available in the case where type Address is non-private and the
kono
parents:
diff changeset
39 -- operations have been made abstract in the spec of System (to avoid
kono
parents:
diff changeset
40 -- inappropriate use by applications programs). In addition, the logical
kono
parents:
diff changeset
41 -- operations may not be available if type Address is a signed integer.
kono
parents:
diff changeset
42
kono
parents:
diff changeset
43 pragma Compiler_Unit_Warning;
kono
parents:
diff changeset
44
kono
parents:
diff changeset
45 package System.Address_Operations is
kono
parents:
diff changeset
46 pragma Pure;
kono
parents:
diff changeset
47
kono
parents:
diff changeset
48 -- The semantics of the arithmetic operations are those that apply to
kono
parents:
diff changeset
49 -- a modular type with the same length as Address, i.e. they provide
kono
parents:
diff changeset
50 -- twos complement wrap around arithmetic treating the address value
kono
parents:
diff changeset
51 -- as an unsigned value, with no overflow checking.
kono
parents:
diff changeset
52
kono
parents:
diff changeset
53 -- Note that we do not use the infix names for these operations to
kono
parents:
diff changeset
54 -- avoid problems with ambiguities coming from declarations in package
kono
parents:
diff changeset
55 -- Standard (which may or may not be visible depending on the exact
kono
parents:
diff changeset
56 -- form of the declaration of type System.Address).
kono
parents:
diff changeset
57
kono
parents:
diff changeset
58 -- For addition, subtraction, and multiplication, the effect of overflow
kono
parents:
diff changeset
59 -- is 2's complement wrapping (as though the type Address were unsigned).
kono
parents:
diff changeset
60
kono
parents:
diff changeset
61 -- For division and modulus operations, the caller is responsible for
kono
parents:
diff changeset
62 -- ensuring that the Right argument is non-zero, and the effect of the
kono
parents:
diff changeset
63 -- call is not specified if a zero argument is passed.
kono
parents:
diff changeset
64
kono
parents:
diff changeset
65 function AddA (Left, Right : Address) return Address;
kono
parents:
diff changeset
66 function SubA (Left, Right : Address) return Address;
kono
parents:
diff changeset
67 function MulA (Left, Right : Address) return Address;
kono
parents:
diff changeset
68 function DivA (Left, Right : Address) return Address;
kono
parents:
diff changeset
69 function ModA (Left, Right : Address) return Address;
kono
parents:
diff changeset
70
kono
parents:
diff changeset
71 -- The semantics of the logical operations are those that apply to
kono
parents:
diff changeset
72 -- a modular type with the same length as Address, i.e. they provide
kono
parents:
diff changeset
73 -- bit-wise operations on all bits of the value (including the sign
kono
parents:
diff changeset
74 -- bit if Address is a signed integer type).
kono
parents:
diff changeset
75
kono
parents:
diff changeset
76 function AndA (Left, Right : Address) return Address;
kono
parents:
diff changeset
77 function OrA (Left, Right : Address) return Address;
kono
parents:
diff changeset
78
kono
parents:
diff changeset
79 pragma Inline_Always (AddA);
kono
parents:
diff changeset
80 pragma Inline_Always (SubA);
kono
parents:
diff changeset
81 pragma Inline_Always (MulA);
kono
parents:
diff changeset
82 pragma Inline_Always (DivA);
kono
parents:
diff changeset
83 pragma Inline_Always (ModA);
kono
parents:
diff changeset
84 pragma Inline_Always (AndA);
kono
parents:
diff changeset
85 pragma Inline_Always (OrA);
kono
parents:
diff changeset
86
kono
parents:
diff changeset
87 end System.Address_Operations;