aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/libgnat
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@adacore.com>2020-05-07 03:09:18 -0400
committerPierre-Marie de Rodat <derodat@adacore.com>2020-07-06 07:35:09 -0400
commit90d8163d9b9d90ceeead4e360b9d8d8dc2878074 (patch)
treeabb554916f240b9923539502c2b8204aefe839a1 /gcc/ada/libgnat
parentcf7cdde51a249ff292b603dc345a19d343461779 (diff)
downloadgcc-90d8163d9b9d90ceeead4e360b9d8d8dc2878074.zip
gcc-90d8163d9b9d90ceeead4e360b9d8d8dc2878074.tar.gz
gcc-90d8163d9b9d90ceeead4e360b9d8d8dc2878074.tar.bz2
[Ada] AI12-0366 Changes to Big_Integer and Big_Real
gcc/ada/ * libgnat/a-nbnbin.ads, libgnat/a-nbnbin.adb, libgnat/a-nbnbin__gmp.adb: Use more Valid_Big_Integer.
Diffstat (limited to 'gcc/ada/libgnat')
-rw-r--r--gcc/ada/libgnat/a-nbnbin.adb6
-rw-r--r--gcc/ada/libgnat/a-nbnbin.ads11
-rw-r--r--gcc/ada/libgnat/a-nbnbin__gmp.adb4
3 files changed, 11 insertions, 10 deletions
diff --git a/gcc/ada/libgnat/a-nbnbin.adb b/gcc/ada/libgnat/a-nbnbin.adb
index 9c8b733..5d415d9 100644
--- a/gcc/ada/libgnat/a-nbnbin.adb
+++ b/gcc/ada/libgnat/a-nbnbin.adb
@@ -133,7 +133,7 @@ package body Ada.Numerics.Big_Numbers.Big_Integers is
-- To_Integer --
----------------
- function To_Integer (Arg : Big_Integer) return Integer is
+ function To_Integer (Arg : Valid_Big_Integer) return Integer is
begin
return Integer (From_Bignum (Get_Bignum (Arg)));
end To_Integer;
@@ -159,7 +159,7 @@ package body Ada.Numerics.Big_Numbers.Big_Integers is
-- From_Big_Integer --
----------------------
- function From_Big_Integer (Arg : Big_Integer) return Int is
+ function From_Big_Integer (Arg : Valid_Big_Integer) return Int is
begin
return Int (From_Bignum (Get_Bignum (Arg)));
end From_Big_Integer;
@@ -187,7 +187,7 @@ package body Ada.Numerics.Big_Numbers.Big_Integers is
-- From_Big_Integer --
----------------------
- function From_Big_Integer (Arg : Big_Integer) return Int is
+ function From_Big_Integer (Arg : Valid_Big_Integer) return Int is
begin
return Int (From_Bignum (Get_Bignum (Arg)));
end From_Big_Integer;
diff --git a/gcc/ada/libgnat/a-nbnbin.ads b/gcc/ada/libgnat/a-nbnbin.ads
index 98619aa..74232f9 100644
--- a/gcc/ada/libgnat/a-nbnbin.ads
+++ b/gcc/ada/libgnat/a-nbnbin.ads
@@ -58,10 +58,11 @@ is
then Big_Natural >= To_Big_Integer (0)),
Predicate_Failure => (raise Constraint_Error);
- function In_Range (Arg, Low, High : Big_Integer) return Boolean is
- ((Low <= Arg) and (Arg <= High));
+ function In_Range
+ (Arg : Valid_Big_Integer; Low, High : Big_Integer) return Boolean
+ is (Low <= Arg and Arg <= High);
- function To_Integer (Arg : Big_Integer) return Integer
+ function To_Integer (Arg : Valid_Big_Integer) return Integer
with Pre => In_Range (Arg,
Low => To_Big_Integer (Integer'First),
High => To_Big_Integer (Integer'Last))
@@ -73,7 +74,7 @@ is
function To_Big_Integer (Arg : Int) return Valid_Big_Integer;
- function From_Big_Integer (Arg : Big_Integer) return Int
+ function From_Big_Integer (Arg : Valid_Big_Integer) return Int
with Pre => In_Range (Arg,
Low => To_Big_Integer (Int'First),
High => To_Big_Integer (Int'Last))
@@ -87,7 +88,7 @@ is
function To_Big_Integer (Arg : Int) return Valid_Big_Integer;
- function From_Big_Integer (Arg : Big_Integer) return Int
+ function From_Big_Integer (Arg : Valid_Big_Integer) return Int
with Pre => In_Range (Arg,
Low => To_Big_Integer (Int'First),
High => To_Big_Integer (Int'Last))
diff --git a/gcc/ada/libgnat/a-nbnbin__gmp.adb b/gcc/ada/libgnat/a-nbnbin__gmp.adb
index 025272f..9481eed 100644
--- a/gcc/ada/libgnat/a-nbnbin__gmp.adb
+++ b/gcc/ada/libgnat/a-nbnbin__gmp.adb
@@ -330,7 +330,7 @@ package body Ada.Numerics.Big_Numbers.Big_Integers is
-- From_String --
-----------------
- function From_String (Arg : String) return Valid_Big_Integer is
+ function From_String (Arg : String) return Big_Integer is
function mpz_set_str
(this : access mpz_t;
str : System.Address;
@@ -405,7 +405,7 @@ package body Ada.Numerics.Big_Numbers.Big_Integers is
-- Put_Image --
---------------
- procedure Put_Image (S : in out Sink'Class; V : Big_Real) is
+ procedure Put_Image (S : in out Sink'Class; V : Big_Integer) is
-- This is implemented in terms of To_String. It might be more elegant
-- and more efficient to do it the other way around, but this is the
-- most expedient implementation for now.