Commit 16788d44 by Robert Dewar Committed by Arnaud Charlet

exp_ch4.adb, [...]: Minor reformatting.

2013-07-05  Robert Dewar  <dewar@adacore.com>

	* exp_ch4.adb, a-cfdlli.ads, a-ngelfu.ads, s-bignum.adb: Minor
	reformatting.

From-SVN: r200707
parent da1b76c1
2013-07-05 Robert Dewar <dewar@adacore.com>
* exp_ch4.adb, a-cfdlli.ads, a-ngelfu.ads, s-bignum.adb: Minor
reformatting.
2013-07-05 Hristian Kirtchev <kirtchev@adacore.com> 2013-07-05 Hristian Kirtchev <kirtchev@adacore.com>
* exp_ch4.adb (Expand_Composite_Equality): Use the full view * exp_ch4.adb (Expand_Composite_Equality): Use the full view
......
...@@ -78,30 +78,36 @@ package Ada.Containers.Formal_Doubly_Linked_Lists is ...@@ -78,30 +78,36 @@ package Ada.Containers.Formal_Doubly_Linked_Lists is
procedure Clear (Container : in out List); procedure Clear (Container : in out List);
procedure Assign (Target : in out List; Source : List) procedure Assign (Target : in out List; Source : List) with
with Pre => Target.Capacity >= Length (Source); Pre => Target.Capacity >= Length (Source);
function Copy (Source : List; Capacity : Count_Type := 0) return List; function Copy (Source : List; Capacity : Count_Type := 0) return List;
function Element (Container : List; Position : Cursor) return Element_Type function Element
with Pre => Has_Element (Container, Position); (Container : List;
Position : Cursor) return Element_Type
with
Pre => Has_Element (Container, Position);
procedure Replace_Element procedure Replace_Element
(Container : in out List; (Container : in out List;
Position : Cursor; Position : Cursor;
New_Item : Element_Type) New_Item : Element_Type)
with Pre => Has_Element (Container, Position); with
Pre => Has_Element (Container, Position);
procedure Move (Target : in out List; Source : in out List) procedure Move (Target : in out List; Source : in out List) with
with Pre => Target.Capacity >= Length (Source); Pre => Target.Capacity >= Length (Source);
procedure Insert procedure Insert
(Container : in out List; (Container : in out List;
Before : Cursor; Before : Cursor;
New_Item : Element_Type; New_Item : Element_Type;
Count : Count_Type := 1) Count : Count_Type := 1)
with Pre => Length (Container) + Count <= Container.Capacity and then with
(Has_Element (Container, Before) or else Before = No_Element); Pre => Length (Container) + Count <= Container.Capacity
and then (Has_Element (Container, Before)
or else Before = No_Element);
procedure Insert procedure Insert
(Container : in out List; (Container : in out List;
...@@ -109,114 +115,133 @@ package Ada.Containers.Formal_Doubly_Linked_Lists is ...@@ -109,114 +115,133 @@ package Ada.Containers.Formal_Doubly_Linked_Lists is
New_Item : Element_Type; New_Item : Element_Type;
Position : out Cursor; Position : out Cursor;
Count : Count_Type := 1) Count : Count_Type := 1)
with Pre => Length (Container) + Count <= Container.Capacity and then with
(Has_Element (Container, Before) or else Before = No_Element); Pre => Length (Container) + Count <= Container.Capacity
and then (Has_Element (Container, Before)
or else Before = No_Element);
procedure Insert procedure Insert
(Container : in out List; (Container : in out List;
Before : Cursor; Before : Cursor;
Position : out Cursor; Position : out Cursor;
Count : Count_Type := 1) Count : Count_Type := 1)
with Pre => Length (Container) + Count <= Container.Capacity and then with
(Has_Element (Container, Before) or else Before = No_Element); Pre => Length (Container) + Count <= Container.Capacity
and then (Has_Element (Container, Before)
or else Before = No_Element);
procedure Prepend procedure Prepend
(Container : in out List; (Container : in out List;
New_Item : Element_Type; New_Item : Element_Type;
Count : Count_Type := 1) Count : Count_Type := 1)
with Pre => Length (Container) + Count <= Container.Capacity; with
Pre => Length (Container) + Count <= Container.Capacity;
procedure Append procedure Append
(Container : in out List; (Container : in out List;
New_Item : Element_Type; New_Item : Element_Type;
Count : Count_Type := 1) Count : Count_Type := 1)
with Pre => Length (Container) + Count <= Container.Capacity; with
Pre => Length (Container) + Count <= Container.Capacity;
procedure Delete procedure Delete
(Container : in out List; (Container : in out List;
Position : in out Cursor; Position : in out Cursor;
Count : Count_Type := 1) Count : Count_Type := 1)
with Pre => Has_Element (Container, Position); with
Pre => Has_Element (Container, Position);
procedure Delete_First procedure Delete_First
(Container : in out List; (Container : in out List;
Count : Count_Type := 1) Count : Count_Type := 1)
with Pre => not Is_Empty (Container); with
Pre => not Is_Empty (Container);
procedure Delete_Last procedure Delete_Last
(Container : in out List; (Container : in out List;
Count : Count_Type := 1) Count : Count_Type := 1)
with Pre => not Is_Empty (Container); with
Pre => not Is_Empty (Container);
procedure Reverse_Elements (Container : in out List); procedure Reverse_Elements (Container : in out List);
procedure Swap procedure Swap
(Container : in out List; (Container : in out List;
I, J : Cursor) I, J : Cursor)
with Pre => Has_Element (Container, I) and then Has_Element (Container, J); with
Pre => Has_Element (Container, I) and then Has_Element (Container, J);
procedure Swap_Links procedure Swap_Links
(Container : in out List; (Container : in out List;
I, J : Cursor) I, J : Cursor)
with Pre => Has_Element (Container, I) and then Has_Element (Container, J); with
Pre => Has_Element (Container, I) and then Has_Element (Container, J);
procedure Splice procedure Splice
(Target : in out List; (Target : in out List;
Before : Cursor; Before : Cursor;
Source : in out List) Source : in out List)
with Pre => Length (Source) + Length (Target) <= Target.Capacity and then with
(Has_Element (Target, Before) or else Before = No_Element); Pre => Length (Source) + Length (Target) <= Target.Capacity
and then (Has_Element (Target, Before)
or else Before = No_Element);
procedure Splice procedure Splice
(Target : in out List; (Target : in out List;
Before : Cursor; Before : Cursor;
Source : in out List; Source : in out List;
Position : in out Cursor) Position : in out Cursor)
with Pre => Length (Source) + Length (Target) <= Target.Capacity and then with
(Has_Element (Target, Before) or else Before = No_Element) and then Pre => Length (Source) + Length (Target) <= Target.Capacity
Has_Element (Source, Position); and then (Has_Element (Target, Before)
or else Before = No_Element)
and then Has_Element (Source, Position);
procedure Splice procedure Splice
(Container : in out List; (Container : in out List;
Before : Cursor; Before : Cursor;
Position : Cursor) Position : Cursor)
with Pre => 2 * Length (Container) <= Container.Capacity and then with
(Has_Element (Container, Before) or else Before = No_Element) and then Pre => 2 * Length (Container) <= Container.Capacity
Has_Element (Container, Position); and then (Has_Element (Container, Before)
or else Before = No_Element)
and then Has_Element (Container, Position);
function First (Container : List) return Cursor; function First (Container : List) return Cursor;
function First_Element (Container : List) return Element_Type function First_Element (Container : List) return Element_Type with
with Pre => not Is_Empty (Container); Pre => not Is_Empty (Container);
function Last (Container : List) return Cursor; function Last (Container : List) return Cursor;
function Last_Element (Container : List) return Element_Type function Last_Element (Container : List) return Element_Type with
with Pre => not Is_Empty (Container); Pre => not Is_Empty (Container);
function Next (Container : List; Position : Cursor) return Cursor function Next (Container : List; Position : Cursor) return Cursor with
with Pre => Has_Element (Container, Position) or else Position = No_Element; Pre => Has_Element (Container, Position) or else Position = No_Element;
procedure Next (Container : List; Position : in out Cursor) procedure Next (Container : List; Position : in out Cursor) with
with Pre => Has_Element (Container, Position) or else Position = No_Element; Pre => Has_Element (Container, Position) or else Position = No_Element;
function Previous (Container : List; Position : Cursor) return Cursor function Previous (Container : List; Position : Cursor) return Cursor with
with Pre => Has_Element (Container, Position) or else Position = No_Element; Pre => Has_Element (Container, Position) or else Position = No_Element;
procedure Previous (Container : List; Position : in out Cursor) procedure Previous (Container : List; Position : in out Cursor) with
with Pre => Has_Element (Container, Position) or else Position = No_Element; Pre => Has_Element (Container, Position) or else Position = No_Element;
function Find function Find
(Container : List; (Container : List;
Item : Element_Type; Item : Element_Type;
Position : Cursor := No_Element) return Cursor Position : Cursor := No_Element) return Cursor
with Pre => Has_Element (Container, Position) or else Position = No_Element; with
Pre => Has_Element (Container, Position) or else Position = No_Element;
function Reverse_Find function Reverse_Find
(Container : List; (Container : List;
Item : Element_Type; Item : Element_Type;
Position : Cursor := No_Element) return Cursor Position : Cursor := No_Element) return Cursor
with Pre => Has_Element (Container, Position) or else Position = No_Element; with
Pre => Has_Element (Container, Position) or else Position = No_Element;
function Contains function Contains
(Container : List; (Container : List;
...@@ -241,10 +266,10 @@ package Ada.Containers.Formal_Doubly_Linked_Lists is ...@@ -241,10 +266,10 @@ package Ada.Containers.Formal_Doubly_Linked_Lists is
-- they are structurally equal (function "=" returns True) and that they -- they are structurally equal (function "=" returns True) and that they
-- have the same set of cursors. -- have the same set of cursors.
function Left (Container : List; Position : Cursor) return List function Left (Container : List; Position : Cursor) return List with
with Pre => Has_Element (Container, Position) or else Position = No_Element; Pre => Has_Element (Container, Position) or else Position = No_Element;
function Right (Container : List; Position : Cursor) return List function Right (Container : List; Position : Cursor) return List with
with Pre => Has_Element (Container, Position) or else Position = No_Element; Pre => Has_Element (Container, Position) or else Position = No_Element;
-- Left returns a container containing all elements preceding Position -- Left returns a container containing all elements preceding Position
-- (excluded) in Container. Right returns a container containing all -- (excluded) in Container. Right returns a container containing all
-- elements following Position (included) in Container. These two new -- elements following Position (included) in Container. These two new
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- S p e c --
-- -- -- --
-- Copyright (C) 2012, Free Software Foundation, Inc. -- -- Copyright (C) 2012-2013, Free Software Foundation, Inc. --
-- -- -- --
-- This specification is derived from the Ada Reference Manual for use with -- -- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow -- -- GNAT. The copyright notice above, and the license provisions that follow --
...@@ -39,139 +39,114 @@ generic ...@@ -39,139 +39,114 @@ generic
package Ada.Numerics.Generic_Elementary_Functions is package Ada.Numerics.Generic_Elementary_Functions is
pragma Pure; pragma Pure;
function Sqrt (X : Float_Type'Base) return Float_Type'Base function Sqrt (X : Float_Type'Base) return Float_Type'Base with
with
Post => Sqrt'Result >= 0.0 Post => Sqrt'Result >= 0.0
and then (if X = 0.0 then Sqrt'Result = 0.0) and then (if X = 0.0 then Sqrt'Result = 0.0)
and then (if X = 1.0 then Sqrt'Result = 1.0); and then (if X = 1.0 then Sqrt'Result = 1.0);
function Log (X : Float_Type'Base) return Float_Type'Base function Log (X : Float_Type'Base) return Float_Type'Base
with with
Post => (if X = 1.0 then Log'Result = 0.0); Post => (if X = 1.0 then Log'Result = 0.0);
function Log (X, Base : Float_Type'Base) return Float_Type'Base function Log (X, Base : Float_Type'Base) return Float_Type'Base with
with
Post => (if X = 1.0 then Log'Result = 0.0); Post => (if X = 1.0 then Log'Result = 0.0);
function Exp (X : Float_Type'Base) return Float_Type'Base function Exp (X : Float_Type'Base) return Float_Type'Base with
with
Post => (if X = 0.0 then Exp'Result = 1.0); Post => (if X = 0.0 then Exp'Result = 1.0);
function "**" (Left, Right : Float_Type'Base) return Float_Type'Base function "**" (Left, Right : Float_Type'Base) return Float_Type'Base with
with
Post => "**"'Result >= 0.0 Post => "**"'Result >= 0.0
and then (if Right = 0.0 then "**"'Result = 1.0) and then (if Right = 0.0 then "**"'Result = 1.0)
and then (if Right = 1.0 then "**"'Result = Left) and then (if Right = 1.0 then "**"'Result = Left)
and then (if Left = 1.0 then "**"'Result = 1.0) and then (if Left = 1.0 then "**"'Result = 1.0)
and then (if Left = 0.0 then "**"'Result = 0.0); and then (if Left = 0.0 then "**"'Result = 0.0);
function Sin (X : Float_Type'Base) return Float_Type'Base function Sin (X : Float_Type'Base) return Float_Type'Base with
with
Post => Sin'Result in -1.0 .. 1.0 Post => Sin'Result in -1.0 .. 1.0
and then (if X = 0.0 then Sin'Result = 0.0); and then (if X = 0.0 then Sin'Result = 0.0);
function Sin (X, Cycle : Float_Type'Base) return Float_Type'Base function Sin (X, Cycle : Float_Type'Base) return Float_Type'Base with
with
Post => Sin'Result in -1.0 .. 1.0 Post => Sin'Result in -1.0 .. 1.0
and then (if X = 0.0 then Sin'Result = 0.0); and then (if X = 0.0 then Sin'Result = 0.0);
function Cos (X : Float_Type'Base) return Float_Type'Base function Cos (X : Float_Type'Base) return Float_Type'Base with
with
Post => Cos'Result in -1.0 .. 1.0 Post => Cos'Result in -1.0 .. 1.0
and then (if X = 0.0 then Cos'Result = 1.0); and then (if X = 0.0 then Cos'Result = 1.0);
function Cos (X, Cycle : Float_Type'Base) return Float_Type'Base function Cos (X, Cycle : Float_Type'Base) return Float_Type'Base with
with
Post => Cos'Result in -1.0 .. 1.0 Post => Cos'Result in -1.0 .. 1.0
and then (if X = 0.0 then Cos'Result = 1.0); and then (if X = 0.0 then Cos'Result = 1.0);
function Tan (X : Float_Type'Base) return Float_Type'Base function Tan (X : Float_Type'Base) return Float_Type'Base with
with
Post => (if X = 0.0 then Tan'Result = 0.0); Post => (if X = 0.0 then Tan'Result = 0.0);
function Tan (X, Cycle : Float_Type'Base) return Float_Type'Base function Tan (X, Cycle : Float_Type'Base) return Float_Type'Base with
with
Post => (if X = 0.0 then Tan'Result = 0.0); Post => (if X = 0.0 then Tan'Result = 0.0);
function Cot (X : Float_Type'Base) return Float_Type'Base; function Cot (X : Float_Type'Base) return Float_Type'Base;
function Cot (X, Cycle : Float_Type'Base) return Float_Type'Base; function Cot (X, Cycle : Float_Type'Base) return Float_Type'Base;
function Arcsin (X : Float_Type'Base) return Float_Type'Base function Arcsin (X : Float_Type'Base) return Float_Type'Base with
with
Post => (if X = 0.0 then Arcsin'Result = 0.0); Post => (if X = 0.0 then Arcsin'Result = 0.0);
function Arcsin (X, Cycle : Float_Type'Base) return Float_Type'Base function Arcsin (X, Cycle : Float_Type'Base) return Float_Type'Base with
with
Post => (if X = 0.0 then Arcsin'Result = 0.0); Post => (if X = 0.0 then Arcsin'Result = 0.0);
function Arccos (X : Float_Type'Base) return Float_Type'Base function Arccos (X : Float_Type'Base) return Float_Type'Base with
with
Post => (if X = 1.0 then Arccos'Result = 0.0); Post => (if X = 1.0 then Arccos'Result = 0.0);
function Arccos (X, Cycle : Float_Type'Base) return Float_Type'Base function Arccos (X, Cycle : Float_Type'Base) return Float_Type'Base with
with
Post => (if X = 1.0 then Arccos'Result = 0.0); Post => (if X = 1.0 then Arccos'Result = 0.0);
function Arctan function Arctan
(Y : Float_Type'Base; (Y : Float_Type'Base;
X : Float_Type'Base := 1.0) X : Float_Type'Base := 1.0) return Float_Type'Base
return Float_Type'Base
with with
Post => (if X > 0.0 and Y = 0.0 then Arctan'Result = 0.0); Post => (if X > 0.0 and Y = 0.0 then Arctan'Result = 0.0);
function Arctan function Arctan
(Y : Float_Type'Base; (Y : Float_Type'Base;
X : Float_Type'Base := 1.0; X : Float_Type'Base := 1.0;
Cycle : Float_Type'Base) Cycle : Float_Type'Base) return Float_Type'Base
return Float_Type'Base
with with
Post => (if X > 0.0 and Y = 0.0 then Arctan'Result = 0.0); Post => (if X > 0.0 and Y = 0.0 then Arctan'Result = 0.0);
function Arccot function Arccot
(X : Float_Type'Base; (X : Float_Type'Base;
Y : Float_Type'Base := 1.0) Y : Float_Type'Base := 1.0) return Float_Type'Base
return Float_Type'Base
with with
Post => (if X > 0.0 and Y = 0.0 then Arccot'Result = 0.0); Post => (if X > 0.0 and Y = 0.0 then Arccot'Result = 0.0);
function Arccot function Arccot
(X : Float_Type'Base; (X : Float_Type'Base;
Y : Float_Type'Base := 1.0; Y : Float_Type'Base := 1.0;
Cycle : Float_Type'Base) Cycle : Float_Type'Base) return Float_Type'Base
return Float_Type'Base
with with
Post => (if X > 0.0 and Y = 0.0 then Arccot'Result = 0.0); Post => (if X > 0.0 and Y = 0.0 then Arccot'Result = 0.0);
function Sinh (X : Float_Type'Base) return Float_Type'Base function Sinh (X : Float_Type'Base) return Float_Type'Base with
with
Post => (if X = 0.0 then Sinh'Result = 0.0); Post => (if X = 0.0 then Sinh'Result = 0.0);
function Cosh (X : Float_Type'Base) return Float_Type'Base function Cosh (X : Float_Type'Base) return Float_Type'Base with
with
Post => Cosh'Result >= 1.0 Post => Cosh'Result >= 1.0
and then (if X = 0.0 then Cosh'Result = 1.0); and then (if X = 0.0 then Cosh'Result = 1.0);
function Tanh (X : Float_Type'Base) return Float_Type'Base function Tanh (X : Float_Type'Base) return Float_Type'Base with
with
Post => Tanh'Result in -1.0 .. 1.0 Post => Tanh'Result in -1.0 .. 1.0
and then (if X = 0.0 then Tanh'Result = 0.0); and then (if X = 0.0 then Tanh'Result = 0.0);
function Coth (X : Float_Type'Base) return Float_Type'Base function Coth (X : Float_Type'Base) return Float_Type'Base with
with
Post => abs Coth'Result >= 1.0; Post => abs Coth'Result >= 1.0;
function Arcsinh (X : Float_Type'Base) return Float_Type'Base function Arcsinh (X : Float_Type'Base) return Float_Type'Base with
with
Post => (if X = 0.0 then Arcsinh'Result = 0.0); Post => (if X = 0.0 then Arcsinh'Result = 0.0);
function Arccosh (X : Float_Type'Base) return Float_Type'Base function Arccosh (X : Float_Type'Base) return Float_Type'Base with
with
Post => Arccosh'Result >= 0.0 Post => Arccosh'Result >= 0.0
and then (if X = 1.0 then Arccosh'Result = 0.0); and then (if X = 1.0 then Arccosh'Result = 0.0);
function Arctanh (X : Float_Type'Base) return Float_Type'Base function Arctanh (X : Float_Type'Base) return Float_Type'Base with
with
Post => (if X = 0.0 then Arctanh'Result = 0.0); Post => (if X = 0.0 then Arctanh'Result = 0.0);
function Arccoth (X : Float_Type'Base) return Float_Type'Base; function Arccoth (X : Float_Type'Base) return Float_Type'Base;
......
...@@ -2587,6 +2587,8 @@ package body Exp_Ch4 is ...@@ -2587,6 +2587,8 @@ package body Exp_Ch4 is
Full_Type := Underlying_Type (Full_Type); Full_Type := Underlying_Type (Full_Type);
end if; end if;
-- Case of array types
if Is_Array_Type (Full_Type) then if Is_Array_Type (Full_Type) then
-- If the operand is an elementary type other than a floating-point -- If the operand is an elementary type other than a floating-point
...@@ -2609,6 +2611,8 @@ package body Exp_Ch4 is ...@@ -2609,6 +2611,8 @@ package body Exp_Ch4 is
return Expand_Array_Equality (Nod, Lhs, Rhs, Bodies, Full_Type); return Expand_Array_Equality (Nod, Lhs, Rhs, Bodies, Full_Type);
end if; end if;
-- Case of tagged record types
elsif Is_Tagged_Type (Full_Type) then elsif Is_Tagged_Type (Full_Type) then
-- Call the primitive operation "=" of this type -- Call the primitive operation "=" of this type
...@@ -2653,6 +2657,8 @@ package body Exp_Ch4 is ...@@ -2653,6 +2657,8 @@ package body Exp_Ch4 is
(Unchecked_Convert_To (Etype (First_Formal (Eq_Op)), Lhs), (Unchecked_Convert_To (Etype (First_Formal (Eq_Op)), Lhs),
Unchecked_Convert_To (Etype (First_Formal (Eq_Op)), Rhs))); Unchecked_Convert_To (Etype (First_Formal (Eq_Op)), Rhs)));
-- Case of untagged record types
elsif Is_Record_Type (Full_Type) then elsif Is_Record_Type (Full_Type) then
Eq_Op := TSS (Full_Type, TSS_Composite_Equality); Eq_Op := TSS (Full_Type, TSS_Composite_Equality);
...@@ -2821,9 +2827,9 @@ package body Exp_Ch4 is ...@@ -2821,9 +2827,9 @@ package body Exp_Ch4 is
return Expand_Record_Equality (Nod, Full_Type, Lhs, Rhs, Bodies); return Expand_Record_Equality (Nod, Full_Type, Lhs, Rhs, Bodies);
end if; end if;
else -- Non-composite types (always use predefined equality)
-- If not array or record type, it is predefined equality.
else
return Make_Op_Eq (Loc, Left_Opnd => Lhs, Right_Opnd => Rhs); return Make_Op_Eq (Loc, Left_Opnd => Lhs, Right_Opnd => Rhs);
end if; end if;
end Expand_Composite_Equality; end Expand_Composite_Equality;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 2012, Free Software Foundation, Inc. -- -- Copyright (C) 2012-2013, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -64,14 +64,18 @@ package body System.Bignums is ...@@ -64,14 +64,18 @@ package body System.Bignums is
-- Local Subprograms -- -- Local Subprograms --
----------------------- -----------------------
function Add (X, Y : Digit_Vector; X_Neg, Y_Neg : Boolean) return Bignum function Add
with Pre => X'First = 1 and then Y'First = 1; (X, Y : Digit_Vector;
X_Neg : Boolean;
Y_Neg : Boolean) return Bignum
with
Pre => X'First = 1 and then Y'First = 1;
-- This procedure adds two signed numbers returning the Sum, it is used -- This procedure adds two signed numbers returning the Sum, it is used
-- for both addition and subtraction. The value computed is X + Y, with -- for both addition and subtraction. The value computed is X + Y, with
-- X_Neg and Y_Neg giving the signs of the operands. -- X_Neg and Y_Neg giving the signs of the operands.
function Allocate_Bignum (Len : Length) return Bignum function Allocate_Bignum (Len : Length) return Bignum with
with Post => Allocate_Bignum'Result.Len = Len; Post => Allocate_Bignum'Result.Len = Len;
-- Allocate Bignum value of indicated length on secondary stack. On return -- Allocate Bignum value of indicated length on secondary stack. On return
-- the Neg and D fields are left uninitialized. -- the Neg and D fields are left uninitialized.
...@@ -81,7 +85,8 @@ package body System.Bignums is ...@@ -81,7 +85,8 @@ package body System.Bignums is
function Compare function Compare
(X, Y : Digit_Vector; (X, Y : Digit_Vector;
X_Neg, Y_Neg : Boolean) return Compare_Result X_Neg, Y_Neg : Boolean) return Compare_Result
with Pre => X'First = 1 and then Y'First = 1; with
Pre => X'First = 1 and then Y'First = 1;
-- Compare (X with sign X_Neg) with (Y with sign Y_Neg), and return the -- Compare (X with sign X_Neg) with (Y with sign Y_Neg), and return the
-- result of the signed comparison. -- result of the signed comparison.
...@@ -113,7 +118,11 @@ package body System.Bignums is ...@@ -113,7 +118,11 @@ package body System.Bignums is
-- Add -- -- Add --
--------- ---------
function Add (X, Y : Digit_Vector; X_Neg, Y_Neg : Boolean) return Bignum is function Add
(X, Y : Digit_Vector;
X_Neg : Boolean;
Y_Neg : Boolean) return Bignum
is
begin begin
-- If signs are the same, we are doing an addition, it is convenient to -- If signs are the same, we are doing an addition, it is convenient to
-- ensure that the first operand is the longer of the two. -- ensure that the first operand is the longer of the two.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment