with
Pre => In_Double_Int_Range (Big (X) + Big (Y)),
Post => Add_With_Ovflo_Check'Result = X + Y;
- -- Raises Constraint_Error if sum of operands overflows 64 bits,
- -- otherwise returns the 64-bit signed integer sum.
+ -- Raises Constraint_Error if sum of operands overflows Double_Int,
+ -- otherwise returns this sum of operands as Double_Int.
--
-- The sum of ``X`` and ``Y`` is first computed using wrap-around
-- semantics.
with
Pre => In_Double_Int_Range (Big (X) - Big (Y)),
Post => Subtract_With_Ovflo_Check'Result = X - Y;
- -- Raises Constraint_Error if difference of operands overflows 64
- -- bits, otherwise returns the 64-bit signed integer difference.
+ -- Raises Constraint_Error if difference of operands overflows Double_Int,
+ -- otherwise returns this difference of operands as Double_Int.
--
-- The logic of the implementation is reversed from *Add_With_Ovflo_Check*:
-- if ``X`` and ``Y`` have the same sign, no overflow is checked, otherwise
Pre => In_Double_Int_Range (Big (X) * Big (Y)),
Post => Multiply_With_Ovflo_Check'Result = X * Y;
pragma Convention (C, Multiply_With_Ovflo_Check);
- -- Raises Constraint_Error if product of operands overflows 64
- -- bits, otherwise returns the 64-bit signed integer product.
- -- GIGI may also call this routine directly.
+ -- Raises Constraint_Error if product of operands overflows Double_Int,
+ -- otherwise returns this product of operands as Double_Int. The code
+ -- generator may also generate direct calls to this routine.
--
- -- The multiplication is done using pencil and paper algorithm using base
- -- 2**32. The multiplication is done on unsigned values, then the correct
+ -- The multiplication is done using pencil and paper algorithm applied to
+ -- Single_Uns, that is to say done on unsigned values, then the correct
-- signed value is returned. Overflow check is performed by looking at
-- higher digits.
-- quotient. The remainder ``R`` is not affected by the setting of the
-- ``Round`` flag.
--
- -- The multiplication is done using pencil and paper algorithm using base
- -- 2**32. The multiplication is done on unsigned values. The result is a
- -- 128 bit value.
+ -- The multiplication is done using pencil and paper algorithm applied to
+ -- Single_Uns, that is to say done on unsigned values. The result is a
+ -- pair of Double_Uns values.
--
-- The overflow is detected on the intermediate value.
--
- -- If Z is a 32 bit value, the division is done using pencil and paper
+ -- If Z is a Single_Uns value, the division is done using pencil and paper
-- algorithm.
--
-- Otherwise, the division is performed using the algorithm D from section
--
-- Division by 0 is first detected.
--
- -- The intermediate value ``Y`` * ``Z`` is then computed on 128 bits. The
- -- multiplication is done on unsigned values.
+ -- The intermediate value ``Y`` * ``Z`` is then computed as a pair of
+ -- Double_Uns value. that is to say done on unsigned values.
--
- -- If the high 64 bits of the intermediate value is not 0, then 0 is
+ -- If the high Double_Uns of the intermediate value is not 0, then 0 is
-- returned. The overflow case of the largest negative number divided by
-- -1 is detected here.
--
- -- 64-bit division is then performed, the result is rounded, its sign is
- -- corrected, and then returned.
+ -- Double_Uns division is then performed, the result is rounded, its sign
+ -- is corrected, and then returned.
end System.Arith_Double;