]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Fix outdated description in System.Arith_* units
authorEric Botcazou <ebotcazou@adacore.com>
Thu, 31 Oct 2024 08:12:48 +0000 (09:12 +0100)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Thu, 14 Nov 2024 13:54:31 +0000 (14:54 +0100)
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.

gcc/ada/libgnat/s-aridou.ads
gcc/ada/libgnat/s-arit128.ads
gcc/ada/libgnat/s-arit64.ads

index f1275adbd57a48815045d15afb1cb69f1cf920e3..4618295e0ac024d98325bd02a1b6d255a6c02110 100644 (file)
@@ -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;
index 3eb170f42b3d2a0e496f621bf094b332a6cabcbd..275b30fca9f4eb18d215330d7b55685999883e61 100644 (file)
@@ -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))
index cbf0af5fc25dcad6bd8af9fbe5226194ffe001f3..efc1f5f877fe40558018f29b55a45bb409375222 100644 (file)
@@ -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