
-- 1: --------------------------------
-- 2: -- Ivan Levashew aka OCTAGRAM --
-- 3: --         Barnaul, 2009-2010 --
-- 4: --------------------------------

-- 5:
-- 6: -- Turbo_Private.Bits, 32bit version

-- 7:

-- 8: with System, Interfaces, System.Storage_Elements;
with system;

-- 9:

-- 10: package Turbo_Private.Bits is
with turbo_private;
with system;
with system;
with interfaces;
with system.system__storage_elements;
with system.system__assertions;
turbo_private__bits_E : boolean := false;
package turbo_private.turbo_private__bits is

-- 11:    pragma Preelaborate;
   pragma preelaborate;

-- 12:    pragma Assert (System.Address'Size = 32, "Platform isn't 32bit, BITS must be readjusted");
   null;

-- 13:

-- 14:    type Integer_Addr  is new Interfaces.Integer_32;
   [type interfaces__Tinteger_32B is new integer]
   [type turbo_private__bits__Tinteger_addrB is new
     interfaces__Tinteger_32B]
   freeze turbo_private__bits__Tinteger_addrB []

-- 15:    type Unsigned_Addr is new Interfaces.Unsigned_32;
   type turbo_private__bits__integer_addr is new interfaces.
     interfaces__integer_32;
   [type turbo_private__bits__Tunsigned_addrB is  mod 16#1000_0000_0#]
   freeze turbo_private__bits__Tunsigned_addrB []
   type turbo_private__bits__unsigned_addr is new interfaces.
     interfaces__unsigned_32;

-- 16:
-- 17:    -----------------
-- 18:    -- Conversions --
-- 19:    -----------------

-- 20:

-- 21:    function "+" (Item : Integer_Addr) return System.Storage_Elements.Storage_Offset;
   function turbo_private__bits__Oadd (item :
     turbo_private__bits__integer_addr) return system.
     system__storage_elements.system__storage_elements__storage_offset;

-- 22:    function "+" (Item : System.Storage_Elements.Storage_Offset) return Integer_Addr;
   function turbo_private__bits__Oadd__2 (item : system.
     system__storage_elements.system__storage_elements__storage_offset)
     return turbo_private__bits__integer_addr;

-- 23:

-- 24:    function "+" (Item : Unsigned_Addr) return System.Address;
   function turbo_private__bits__Oadd__3 (item :
     turbo_private__bits__unsigned_addr) return system.system__address;

-- 25:    function "+" (Item : System.Address) return Unsigned_Addr;
   function turbo_private__bits__Oadd__4 (item : system.system__address)
     return turbo_private__bits__unsigned_addr;

-- 26:

-- 27:    function "+" (Item : Unsigned_Addr) return System.Storage_Elements.Integer_Address;
   function turbo_private__bits__Oadd__5 (item :
     turbo_private__bits__unsigned_addr) return system.
     system__storage_elements.system__storage_elements__integer_address;

-- 28:    function "+" (Item : System.Storage_Elements.Integer_Address) return Unsigned_Addr;
   function turbo_private__bits__Oadd__6 (item : system.
     system__storage_elements.system__storage_elements__integer_address)
     return turbo_private__bits__unsigned_addr;

-- 29:

-- 30:    function "+" (Item : System.Address) return System.Storage_Elements.Integer_Address

-- 31:      renames System.Storage_Elements.To_Integer;
   function turbo_private__bits__Oadd__7 (item : system.system__address)
     return system.system__storage_elements.
     system__storage_elements__integer_address renames system.
     system__storage_elements.system__storage_elements__to_integer;

-- 32:    function "+" (Item : System.Storage_Elements.Integer_Address) return System.Address

-- 33:      renames System.Storage_Elements.To_Address;
   function turbo_private__bits__Oadd__8 (item : system.
     system__storage_elements.system__storage_elements__integer_address)
     return system.system__address renames system.
     system__storage_elements.system__storage_elements__to_address;

-- 34:
-- 35:    ----------------
-- 36:    -- Arithmetic --
-- 37:    ----------------

-- 38:
-- 39: -- Q: Why did I commented out this API?
-- 40: -- A: Because I don't use it
-- 41: -- A: Because things like X'Address + 7 become ambiguous
-- 42: -- A: Because it's easy to recreate using "+"es if needed

-- 43:
-- 44: --    function "+" (Left : System.Address; Right : Integer_Addr)
-- 45: --      return System.Address;
-- 46: --    function "+" (Left : Integer_Addr; Right : System.Address)
-- 47: --      return System.Address;
-- 48: --    function "-" (Left : System.Address; Right : Integer_Addr)
-- 49: --      return System.Address;
-- 50: --    function "-" (Left, Right : System.Address)
-- 51: --      return Integer_Addr;
-- 52: --    function "mod" (Left : System.Address; Right : Integer_Addr)
-- 53: --      return Integer_Addr;

-- 54:
-- 55:    -----------------

-- 56:

-- 57:    function "+" (Left : System.Address; Right : Unsigned_Addr)
   function turbo_private__bits__Oadd__9 (left : system.system__address;
     right : turbo_private__bits__unsigned_addr) return system.
     system__address;

-- 58:      return System.Address;

-- 59:    function "+" (Left : Unsigned_Addr; Right : System.Address)
   function turbo_private__bits__Oadd__10 (left :
     turbo_private__bits__unsigned_addr; right : system.system__address)
     return system.system__address;

-- 60:      return System.Address;

-- 61:    function "-" (Left : System.Address; Right : Unsigned_Addr)
   function turbo_private__bits__Osubtract (left : system.
     system__address; right : turbo_private__bits__unsigned_addr)
     return system.system__address;

-- 62:      return System.Address;

-- 63:    function "-" (Left, Right : System.Address)
   function turbo_private__bits__Osubtract__2 (left : system.
     system__address; right : system.system__address) return
     turbo_private__bits__unsigned_addr;

-- 64:      return Unsigned_Addr;

-- 65:    function "mod" (Left : System.Address; Right : Unsigned_Addr)
   function turbo_private__bits__Omod (left : system.system__address;
     right : turbo_private__bits__unsigned_addr) return
     turbo_private__bits__unsigned_addr;

-- 66:      return Unsigned_Addr;

-- 67:

-- 68:    pragma Inline ("+", "-", "mod");
   pragma inline (Oadd, Osubtract, Omod);
   freeze turbo_private__bits__integer_addr []
   freeze turbo_private__bits__unsigned_addr []
   freeze turbo_private__bits__Oadd []
   freeze turbo_private__bits__Oadd__2 []
   freeze turbo_private__bits__Oadd__3 []
   freeze turbo_private__bits__Oadd__4 []
   freeze turbo_private__bits__Oadd__5 []
   freeze turbo_private__bits__Oadd__6 []
   freeze turbo_private__bits__Oadd__9 []
   freeze turbo_private__bits__Oadd__10 []
   freeze turbo_private__bits__Osubtract []
   freeze turbo_private__bits__Osubtract__2 []
   freeze turbo_private__bits__Omod []

-- 69:

-- 70: end Turbo_Private.Bits;
end turbo_private.turbo_private__bits;
