--  When growing a container, multiply current capacity by this. Doubling
    --  leads to amortized linear-time copying.
 
-   type Int is range System.Min_Int .. System.Max_Int;
+   subtype Int is Long_Long_Integer;
 
    procedure Free is
      new Ada.Unchecked_Deallocation (Elements_Array, Elements_Array_Ptr);
 
 
 --  This algorithm was adapted from GNAT.Heap_Sort_G (see g-hesorg.ad[sb])
 
-with System;
-
 procedure Ada.Containers.Generic_Constrained_Array_Sort
   (Container : in out Array_Type)
 is
-   type T is range System.Min_Int .. System.Max_Int;
+   subtype T is Long_Long_Integer;
 
    function To_Index (J : T) return Index_Type;
    pragma Inline (To_Index);
 
   SPARK_Mode => Off
 is
 
-   type Int is range System.Min_Int .. System.Max_Int;
+   subtype Int is Long_Long_Integer;
 
    function To_Array_Index (Index : Index_Type'Base) return Count_Type'Base;
 
 
 
 --  This algorithm was adapted from GNAT.Heap_Sort (see g-heasor.ad[sb])
 
-with System;
-
 procedure Ada.Containers.Generic_Sort (First, Last : Index_Type'Base) is
-   type T is range System.Min_Int .. System.Max_Int;
+   subtype T is Long_Long_Integer;
 
    function To_Index (J : T) return Index_Type;
    pragma Inline (To_Index);
 
    --  If Valid is True, Size_In_Storage_Elements is set to the size of this
    --  chunk of memory.
 
-   type Byte_Count is mod System.Max_Binary_Modulus;
+   type Byte_Count is mod 2 ** Long_Long_Integer'Size;
    --  Type used for maintaining byte counts, needs to be large enough to
    --  to accommodate counts allowing for repeated use of the same memory.