--------------------------------
-- Ivan Levashew aka OCTAGRAM --
--              Barnaul, 2010 --
--------------------------------

-- Turbo_Private.Bits, 64bit version

package body Turbo_Private.Bits is

   ---------
   -- "+" --
   ---------

   function "+" (Item : Integer_Addr) return System.Storage_Elements.Storage_Offset is
   begin
      return System.Storage_Elements.Storage_Offset (Item);
   end "+";

   ---------
   -- "+" --
   ---------

   function "+" (Item : System.Storage_Elements.Storage_Offset) return Integer_Addr is
   begin
      return Integer_Addr (Item);
   end "+";

   ---------
   -- "+" --
   ---------

   function "+" (Item : Unsigned_Addr) return System.Address is
   begin
      return System.Storage_Elements.To_Address
         (System.Storage_Elements.Integer_Address (Item));
   end "+";

   ---------
   -- "+" --
   ---------

   function "+" (Item : System.Address) return Unsigned_Addr is
   begin
      return Unsigned_Addr (System.Storage_Elements.To_Integer (Item));
   end "+";

   ---------
   -- "+" --
   ---------

   function "+" (Item : Unsigned_Addr) return System.Storage_Elements.Integer_Address is
   begin
      return System.Storage_Elements.Integer_Address (Item);
   end "+";

   ---------
   -- "+" --
   ---------

   function "+" (Item : System.Storage_Elements.Integer_Address) return Unsigned_Addr is
   begin
      return Unsigned_Addr (Item);
   end "+";

   ---------
   -- "+" --
   ---------

   function "+" (Left : System.Address; Right : Integer_Addr)
     return System.Address
   is
   begin
      return System.Storage_Elements."+" (Left, +Right);
   end "+";

   ---------
   -- "+" --
   ---------

   function "+" (Left : Integer_Addr; Right : System.Address)
     return System.Address is
   begin
      return System.Storage_Elements."+" (+Left, Right);
   end "+";
   
   ---------
   -- "-" --
   ---------
   
   function "-" (Left : System.Address; Right : Integer_Addr)
     return System.Address is
   begin
      return System.Storage_Elements."-" (Left, +Right);
   end "-";

   ---------
   -- "-" --
   ---------

   function "-" (Left, Right : System.Address)
     return Integer_Addr is
   begin
      return +System.Storage_Elements."-" (Left, Right);
   end "-";

   -----------
   -- "mod" --
   -----------

   function "mod" (Left : System.Address; Right : Integer_Addr)
     return Integer_Addr is
   begin
      return +System.Storage_Elements."mod" (Left, +Right);
   end "mod";

end Turbo_Private.Bits;
