https://gcc.gnu.org/g:c3db7e37a74680b98bcd8c582f0ef3f8778b4dde
commit r15-5242-gc3db7e37a74680b98bcd8c582f0ef3f8778b4dde Author: Eric Botcazou <ebotca...@adacore.com> Date: Thu Oct 31 09:12:48 2024 +0100 ada: Fix outdated description in System.Arith_* units Mainly System.Arith_Double, which has left-overs from its original version. gcc/ada/ChangeLog: * libgnat/s-aridou.ads (Add_With_Ovflo_Check): Adjust description. (Subtract_With_Ovflo_Check): Likewise. (Multiply_With_Ovflo_Check): Likewise. (Scaled_Divide): Likewise. (Double_Divide): Likewise. * libgnat/s-arit64.ads (Multiply_With_Ovflo_Check64): Likewise. * libgnat/s-arit128.ads (Multiply_With_Ovflo_Check128): Likewise. Diff: --- gcc/ada/libgnat/s-aridou.ads | 36 ++++++++++++++++++------------------ gcc/ada/libgnat/s-arit128.ads | 2 +- gcc/ada/libgnat/s-arit64.ads | 2 +- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/gcc/ada/libgnat/s-aridou.ads b/gcc/ada/libgnat/s-aridou.ads index f1275adbd57a..4618295e0ac0 100644 --- a/gcc/ada/libgnat/s-aridou.ads +++ b/gcc/ada/libgnat/s-aridou.ads @@ -100,8 +100,8 @@ is 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. @@ -118,8 +118,8 @@ is 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 @@ -131,12 +131,12 @@ is 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. @@ -186,13 +186,13 @@ is -- 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 @@ -232,14 +232,14 @@ is -- -- 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; diff --git a/gcc/ada/libgnat/s-arit128.ads b/gcc/ada/libgnat/s-arit128.ads index 3eb170f42b3d..275b30fca9f4 100644 --- a/gcc/ada/libgnat/s-arit128.ads +++ b/gcc/ada/libgnat/s-arit128.ads @@ -96,7 +96,7 @@ is pragma Export (C, Multiply_With_Ovflo_Check128, "__gnat_mulv128"); -- Raises Constraint_Error if product of operands overflows 128 -- bits, otherwise returns the 128-bit signed integer product. - -- Gigi may also call this routine directly. + -- The code generator may also generate direct calls to this routine. function Same_Sign (X, Y : Big_Integer) return Boolean is (X = Big (Int128'(0)) diff --git a/gcc/ada/libgnat/s-arit64.ads b/gcc/ada/libgnat/s-arit64.ads index cbf0af5fc25d..efc1f5f877fe 100644 --- a/gcc/ada/libgnat/s-arit64.ads +++ b/gcc/ada/libgnat/s-arit64.ads @@ -112,7 +112,7 @@ is pragma Export (C, Multiply_With_Ovflo_Check64, "__gnat_mulv64"); -- 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. + -- 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