diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-10-27 13:39:21 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-10-27 13:39:21 +0000 |
commit | 9cfac5897a84034727f2c33be5f23848b7167ac3 (patch) | |
tree | 7ea13d10c80a2d0637721168e92bd18c827a37c8 /gcc/ada/s-arit64.ads | |
parent | 74f6b21d9c2206c1ff89881a648f12b7ed168be1 (diff) | |
download | gcc-9cfac5897a84034727f2c33be5f23848b7167ac3.tar.gz |
2004-10-26 Robert Dewar <dewar@gnat.com>
* s-arit64.adb: (Le3): New function, used by Scaled_Divide
(Sub3): New procedure, used by Scaled_Divide
(Scaled_Divide): Substantial rewrite, avoid duplicated code, and also
correct more than one instance of failure to propagate carries
correctly.
(Double_Divide): Handle overflow case of largest negative number
divided by minus one.
* s-arit64.ads (Double_Divide): Document that overflow can occur in
the case of a quotient value out of range.
Fix comments.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@89663 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/s-arit64.ads')
-rw-r--r-- | gcc/ada/s-arit64.ads | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/gcc/ada/s-arit64.ads b/gcc/ada/s-arit64.ads index 767c145b9d1..55afeaee403 100644 --- a/gcc/ada/s-arit64.ads +++ b/gcc/ada/s-arit64.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1994,1995,1996 Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2004, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -52,7 +52,7 @@ pragma Pure (Arith_64); function Multiply_With_Ovflo_Check (X, Y : Int64) return Int64; -- Raises Constraint_Error if product of operands overflows 64 - -- bits, otherwise returns the 64-bit signed integer difference. + -- bits, otherwise returns the 64-bit signed integer product. procedure Scaled_Divide (X, Y, Z : Int64; @@ -71,12 +71,11 @@ pragma Pure (Arith_64); Q, R : out Int64; Round : Boolean); -- Performs the division X / (Y * Z), storing the quotient in Q and - -- the remainder in R. Constraint_Error is raised if Y or Z is zero. - -- Round indicates if the result should be rounded. If Round is False, - -- then Q, R are the normal quotient and remainder from a truncating - -- division. If Round is True, then Q is the rounded quotient. The - -- remainder R is not affected by the setting of the Round flag. The - -- result is known to be in range except for the noted possibility of - -- Y or Z being zero, so no other overflow checks are required. + -- the remainder in R. Constraint_Error is raised if Y or Z is zero, + -- or if the quotient does not fit in 64-bits. Round indicates if the + -- result should be rounded. If Round is False, then Q, R are the normal + -- quotient and remainder from a truncating division. If Round is True, + -- then Q is the rounded quotient. The remainder R is not affected by the + -- setting of the Round flag. end System.Arith_64; |