Next: Rotate_Right, Previous: Line, Up: Intrinsic Subprograms
In standard Ada 95, the Rotate_Left
function is available only
for the predefined modular types in package Interfaces
. However, in
GNAT it is possible to define a Rotate_Left function for a user
defined modular type or any signed integer type as in this example:
function Shift_Left (Value : My_Modular_Type; Amount : Natural) return My_Modular_Type;
The requirements are that the profile be exactly as in the example
above. The only modifications allowed are in the formal parameter
names, and in the type of Value
and the return type, which
must be the same, and must be either a signed integer type, or
a modular integer type with a binary modulus, and the size must
be 8. 16, 32 or 64 bits.