with Alloc;
with Table;
pragma Elaborate_All (Table);
with Types; use Types;
package Uintp is
type Uint is private;
No_Uint : constant Uint;
Uint_0 : constant Uint;
Uint_1 : constant Uint;
Uint_2 : constant Uint;
Uint_3 : constant Uint;
Uint_4 : constant Uint;
Uint_5 : constant Uint;
Uint_6 : constant Uint;
Uint_7 : constant Uint;
Uint_8 : constant Uint;
Uint_9 : constant Uint;
Uint_10 : constant Uint;
Uint_12 : constant Uint;
Uint_15 : constant Uint;
Uint_16 : constant Uint;
Uint_24 : constant Uint;
Uint_32 : constant Uint;
Uint_63 : constant Uint;
Uint_64 : constant Uint;
Uint_128 : constant Uint;
Uint_Minus_1 : constant Uint;
Uint_Minus_2 : constant Uint;
Uint_Minus_3 : constant Uint;
Uint_Minus_4 : constant Uint;
Uint_Minus_5 : constant Uint;
Uint_Minus_6 : constant Uint;
Uint_Minus_7 : constant Uint;
Uint_Minus_8 : constant Uint;
Uint_Minus_9 : constant Uint;
Uint_Minus_12 : constant Uint;
Uint_Minus_128 : constant Uint;
procedure Initialize;
procedure Tree_Read;
procedure Tree_Write;
function UI_Abs (Right : Uint) return Uint;
pragma Inline (UI_Abs);
function UI_Add (Left : Uint; Right : Uint) return Uint;
function UI_Add (Left : Int; Right : Uint) return Uint;
function UI_Add (Left : Uint; Right : Int) return Uint;
function UI_Decimal_Digits_Hi (U : Uint) return Nat;
function UI_Decimal_Digits_Lo (U : Uint) return Nat;
function UI_Div (Left : Uint; Right : Uint) return Uint;
function UI_Div (Left : Int; Right : Uint) return Uint;
function UI_Div (Left : Uint; Right : Int) return Uint;
function UI_Eq (Left : Uint; Right : Uint) return Boolean;
function UI_Eq (Left : Int; Right : Uint) return Boolean;
function UI_Eq (Left : Uint; Right : Int) return Boolean;
pragma Inline (UI_Eq);
function UI_Expon (Left : Uint; Right : Uint) return Uint;
function UI_Expon (Left : Int; Right : Uint) return Uint;
function UI_Expon (Left : Uint; Right : Int) return Uint;
function UI_Expon (Left : Int; Right : Int) return Uint;
function UI_GCD (Uin, Vin : Uint) return Uint;
function UI_Ge (Left : Uint; Right : Uint) return Boolean;
function UI_Ge (Left : Int; Right : Uint) return Boolean;
function UI_Ge (Left : Uint; Right : Int) return Boolean;
pragma Inline (UI_Ge);
function UI_Gt (Left : Uint; Right : Uint) return Boolean;
function UI_Gt (Left : Int; Right : Uint) return Boolean;
function UI_Gt (Left : Uint; Right : Int) return Boolean;
pragma Inline (UI_Gt);
function UI_Is_In_Int_Range (Input : Uint) return Boolean;
pragma Inline (UI_Is_In_Int_Range);
function UI_Le (Left : Uint; Right : Uint) return Boolean;
function UI_Le (Left : Int; Right : Uint) return Boolean;
function UI_Le (Left : Uint; Right : Int) return Boolean;
pragma Inline (UI_Le);
function UI_Lt (Left : Uint; Right : Uint) return Boolean;
function UI_Lt (Left : Int; Right : Uint) return Boolean;
function UI_Lt (Left : Uint; Right : Int) return Boolean;
function UI_Max (Left : Uint; Right : Uint) return Uint;
function UI_Max (Left : Int; Right : Uint) return Uint;
function UI_Max (Left : Uint; Right : Int) return Uint;
function UI_Min (Left : Uint; Right : Uint) return Uint;
function UI_Min (Left : Int; Right : Uint) return Uint;
function UI_Min (Left : Uint; Right : Int) return Uint;
function UI_Mod (Left : Uint; Right : Uint) return Uint;
function UI_Mod (Left : Int; Right : Uint) return Uint;
function UI_Mod (Left : Uint; Right : Int) return Uint;
pragma Inline (UI_Mod);
function UI_Mul (Left : Uint; Right : Uint) return Uint;
function UI_Mul (Left : Int; Right : Uint) return Uint;
function UI_Mul (Left : Uint; Right : Int) return Uint;
function UI_Ne (Left : Uint; Right : Uint) return Boolean;
function UI_Ne (Left : Int; Right : Uint) return Boolean;
function UI_Ne (Left : Uint; Right : Int) return Boolean;
pragma Inline (UI_Ne);
function UI_Negate (Right : Uint) return Uint;
pragma Inline (UI_Negate);
function UI_Rem (Left : Uint; Right : Uint) return Uint;
function UI_Rem (Left : Int; Right : Uint) return Uint;
function UI_Rem (Left : Uint; Right : Int) return Uint;
function UI_Sub (Left : Uint; Right : Uint) return Uint;
function UI_Sub (Left : Int; Right : Uint) return Uint;
function UI_Sub (Left : Uint; Right : Int) return Uint;
pragma Inline (UI_Sub);
function UI_From_Dint (Input : Dint) return Uint;
function UI_From_Int (Input : Int) return Uint;
function UI_To_Int (Input : Uint) return Int;
function Num_Bits (Input : Uint) return Nat;
type UI_Format is (Hex, Decimal, Auto);
UI_Image_Max : constant := 32;
UI_Image_Buffer : String (1 .. UI_Image_Max);
UI_Image_Length : Natural;
procedure UI_Image (Input : Uint; Format : UI_Format := Auto);
procedure UI_Write (Input : Uint; Format : UI_Format := Auto);
procedure pid (Input : Uint);
pragma Export (Ada, pid);
procedure pih (Input : Uint);
pragma Export (Ada, pih);
function "+" (Left : Uint; Right : Uint) return Uint renames UI_Add;
function "+" (Left : Int; Right : Uint) return Uint renames UI_Add;
function "+" (Left : Uint; Right : Int) return Uint renames UI_Add;
function "/" (Left : Uint; Right : Uint) return Uint renames UI_Div;
function "/" (Left : Int; Right : Uint) return Uint renames UI_Div;
function "/" (Left : Uint; Right : Int) return Uint renames UI_Div;
function "*" (Left : Uint; Right : Uint) return Uint renames UI_Mul;
function "*" (Left : Int; Right : Uint) return Uint renames UI_Mul;
function "*" (Left : Uint; Right : Int) return Uint renames UI_Mul;
function "-" (Left : Uint; Right : Uint) return Uint renames UI_Sub;
function "-" (Left : Int; Right : Uint) return Uint renames UI_Sub;
function "-" (Left : Uint; Right : Int) return Uint renames UI_Sub;
function "**" (Left : Uint; Right : Uint) return Uint renames UI_Expon;
function "**" (Left : Uint; Right : Int) return Uint renames UI_Expon;
function "**" (Left : Int; Right : Uint) return Uint renames UI_Expon;
function "**" (Left : Int; Right : Int) return Uint renames UI_Expon;
function "abs" (Real : Uint) return Uint renames UI_Abs;
function "mod" (Left : Uint; Right : Uint) return Uint renames UI_Mod;
function "mod" (Left : Int; Right : Uint) return Uint renames UI_Mod;
function "mod" (Left : Uint; Right : Int) return Uint renames UI_Mod;
function "rem" (Left : Uint; Right : Uint) return Uint renames UI_Rem;
function "rem" (Left : Int; Right : Uint) return Uint renames UI_Rem;
function "rem" (Left : Uint; Right : Int) return Uint renames UI_Rem;
function "-" (Real : Uint) return Uint renames UI_Negate;
function "=" (Left : Uint; Right : Uint) return Boolean renames UI_Eq;
function "=" (Left : Int; Right : Uint) return Boolean renames UI_Eq;
function "=" (Left : Uint; Right : Int) return Boolean renames UI_Eq;
function ">=" (Left : Uint; Right : Uint) return Boolean renames UI_Ge;
function ">=" (Left : Int; Right : Uint) return Boolean renames UI_Ge;
function ">=" (Left : Uint; Right : Int) return Boolean renames UI_Ge;
function ">" (Left : Uint; Right : Uint) return Boolean renames UI_Gt;
function ">" (Left : Int; Right : Uint) return Boolean renames UI_Gt;
function ">" (Left : Uint; Right : Int) return Boolean renames UI_Gt;
function "<=" (Left : Uint; Right : Uint) return Boolean renames UI_Le;
function "<=" (Left : Int; Right : Uint) return Boolean renames UI_Le;
function "<=" (Left : Uint; Right : Int) return Boolean renames UI_Le;
function "<" (Left : Uint; Right : Uint) return Boolean renames UI_Lt;
function "<" (Left : Int; Right : Uint) return Boolean renames UI_Lt;
function "<" (Left : Uint; Right : Int) return Boolean renames UI_Lt;
type Save_Mark is private;
function Mark return Save_Mark;
procedure Release (M : Save_Mark);
procedure Release_And_Save (M : Save_Mark; UI : in out Uint);
procedure Release_And_Save (M : Save_Mark; UI1, UI2 : in out Uint);
private
type Uint is new Int range Uint_Low_Bound .. Uint_High_Bound;
for Uint'Size use 32;
No_Uint : constant Uint := Uint (Uint_Low_Bound);
Base_Bits : constant := 15;
Base : constant Int := 2 ** Base_Bits;
Min_Direct : constant Int := -(Base - 1);
Max_Direct : constant Int := (Base - 1) * (Base - 1);
type Ctrl is range Int'First .. Int'Last;
Uint_Direct_Bias : constant Ctrl := Ctrl (Uint_Low_Bound) + Ctrl (Base);
Uint_Direct_First : constant Ctrl := Uint_Direct_Bias + Ctrl (Min_Direct);
Uint_Direct_Last : constant Ctrl := Uint_Direct_Bias + Ctrl (Max_Direct);
Uint_0 : constant Uint := Uint (Uint_Direct_Bias);
Uint_1 : constant Uint := Uint (Uint_Direct_Bias + 1);
Uint_2 : constant Uint := Uint (Uint_Direct_Bias + 2);
Uint_3 : constant Uint := Uint (Uint_Direct_Bias + 3);
Uint_4 : constant Uint := Uint (Uint_Direct_Bias + 4);
Uint_5 : constant Uint := Uint (Uint_Direct_Bias + 5);
Uint_6 : constant Uint := Uint (Uint_Direct_Bias + 6);
Uint_7 : constant Uint := Uint (Uint_Direct_Bias + 7);
Uint_8 : constant Uint := Uint (Uint_Direct_Bias + 8);
Uint_9 : constant Uint := Uint (Uint_Direct_Bias + 9);
Uint_10 : constant Uint := Uint (Uint_Direct_Bias + 10);
Uint_12 : constant Uint := Uint (Uint_Direct_Bias + 12);
Uint_15 : constant Uint := Uint (Uint_Direct_Bias + 15);
Uint_16 : constant Uint := Uint (Uint_Direct_Bias + 16);
Uint_24 : constant Uint := Uint (Uint_Direct_Bias + 24);
Uint_32 : constant Uint := Uint (Uint_Direct_Bias + 32);
Uint_63 : constant Uint := Uint (Uint_Direct_Bias + 63);
Uint_64 : constant Uint := Uint (Uint_Direct_Bias + 64);
Uint_128 : constant Uint := Uint (Uint_Direct_Bias + 128);
Uint_Minus_1 : constant Uint := Uint (Uint_Direct_Bias - 1);
Uint_Minus_2 : constant Uint := Uint (Uint_Direct_Bias - 2);
Uint_Minus_3 : constant Uint := Uint (Uint_Direct_Bias - 3);
Uint_Minus_4 : constant Uint := Uint (Uint_Direct_Bias - 4);
Uint_Minus_5 : constant Uint := Uint (Uint_Direct_Bias - 5);
Uint_Minus_6 : constant Uint := Uint (Uint_Direct_Bias - 6);
Uint_Minus_7 : constant Uint := Uint (Uint_Direct_Bias - 7);
Uint_Minus_8 : constant Uint := Uint (Uint_Direct_Bias - 8);
Uint_Minus_9 : constant Uint := Uint (Uint_Direct_Bias - 9);
Uint_Minus_12 : constant Uint := Uint (Uint_Direct_Bias - 12);
Uint_Minus_128 : constant Uint := Uint (Uint_Direct_Bias - 128);
type Save_Mark is record
Save_Uint : Uint;
Save_Udigit : Int;
end record;
Uint_First_Entry : constant Uint := Uint (Uint_Table_Start);
type UI_Vector is array (Pos range <>) of Int;
type Uint_Entry is record
Length : Pos;
Loc : Int;
end record;
package Uints is new Table.Table (
Table_Component_Type => Uint_Entry,
Table_Index_Type => Uint,
Table_Low_Bound => Uint_First_Entry,
Table_Initial => Alloc.Uints_Initial,
Table_Increment => Alloc.Uints_Increment,
Table_Name => "Uints");
package Udigits is new Table.Table (
Table_Component_Type => Int,
Table_Index_Type => Int,
Table_Low_Bound => 0,
Table_Initial => Alloc.Udigits_Initial,
Table_Increment => Alloc.Udigits_Increment,
Table_Name => "Udigits");
end Uintp;