From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.129.50.84 with SMTP id y81mr28725649ywy.33.1468944311911; Tue, 19 Jul 2016 09:05:11 -0700 (PDT) X-Received: by 10.157.5.98 with SMTP id 89mr697141otw.9.1468944311790; Tue, 19 Jul 2016 09:05:11 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!news.glorb.com!peer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!c52no3545965qte.1!news-out.google.com!d68ni5796ith.0!nntp.google.com!f6no2653175ith.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Tue, 19 Jul 2016 09:05:11 -0700 (PDT) In-Reply-To: <59656e9a-8826-490e-9c35-f13f8ff1aa91@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=75.161.76.38; posting-account=lJ3JNwoAAAAQfH3VV9vttJLkThaxtTfC NNTP-Posting-Host: 75.161.76.38 References: <59656e9a-8826-490e-9c35-f13f8ff1aa91@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: Generic formals and Aspects From: Shark8 Injection-Date: Tue, 19 Jul 2016 16:05:11 +0000 Content-Type: text/plain; charset=UTF-8 X-Received-Bytes: 2165 X-Received-Body-CRC: 3952421191 Xref: news.eternal-september.org comp.lang.ada:31100 Date: 2016-07-19T09:05:11-07:00 List-Id: 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;