From: Shark8 <onewingedshark@gmail.com>
Subject: Re: Generic formals and Aspects
Date: Tue, 19 Jul 2016 09:05:11 -0700 (PDT)
Date: 2016-07-19T09:05:11-07:00 [thread overview]
Message-ID: <caca39ba-60af-4f2f-8cf1-e6d53ef45a93@googlegroups.com> (raw)
In-Reply-To: <59656e9a-8826-490e-9c35-f13f8ff1aa91@googlegroups.com>
Try the following:
------ SPEC ------
generic
type Discrete_Type is (<>); -- CANDIDATE
package Big_Endian_Integer_Buffer is
function Get return Discrete_Type;
procedure Set (Value : Discrete_Type);
Private
type Internal is new Discrete_Type
with Static_Predicate => Internal'Size in 16 | 32 | 64;
Size_In_Bytes : constant Positive := Internal'Size / 8;
type Buffer_Type is array (1 .. Size_In_Bytes) of Interfaces.Unsigned_8
with Component_Size => 8;
Buffer : Buffer_Type := (others => 0);
end Big_Endian_Integer_Buffer;
------ BODY ------
package body Big_Endian_Integer_Buffer is
function Get return Discrete_Type is
Result : Discrete_Type
with Import, Address => Buffer'Address;
begin
Return Discrete_Type(Result);
End Get;
procedure Set (Value : Discrete_Type) is
Temp : Internal
with Import, Address => Buffer'Address;
begin
Temp := Internal(Value);
End Set;
end Big_Endian_Integer_Buffer;
next prev parent reply other threads:[~2016-07-19 16:05 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-17 13:17 Generic formals and Aspects Simon Wright
2014-10-17 16:04 ` Shark8
2014-10-17 18:51 ` Simon Wright
2014-10-18 1:43 ` Shark8
2016-07-19 15:49 ` olivermkellogg
2016-07-19 16:04 ` J-P. Rosen
2016-07-19 16:05 ` Shark8 [this message]
2016-07-19 18:00 ` olivermkellogg
2016-07-19 19:23 ` Randy Brukardt
2016-07-20 15:09 ` olivermkellogg
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox