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=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,56525db28240414a X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit X-Received: by 10.68.203.201 with SMTP id ks9mr1650231pbc.7.1361827082232; Mon, 25 Feb 2013 13:18:02 -0800 (PST) X-Received: by 10.50.6.135 with SMTP id b7mr1295740iga.9.1361827082188; Mon, 25 Feb 2013 13:18:02 -0800 (PST) Path: ov8ni17067pbb.1!nntp.google.com!su1no6098341pbb.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Mon, 25 Feb 2013 13:18:01 -0800 (PST) In-Reply-To: <9c180f15-28b5-46ca-929d-b731058d0a97@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=129.59.203.209; posting-account=7Oy7OQoAAABhVYFOo553Cn1-AaU-bSfl NNTP-Posting-Host: 129.59.203.209 References: <01983f1c-f842-4b1f-a180-bcef531dad4c@googlegroups.com> <87ipdf4vh6.fsf@mid.deneb.enyo.de> <4ce44d2d-d789-42a0-a6ed-035f7f8d58be@googlegroups.com> <9c180f15-28b5-46ca-929d-b731058d0a97@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <604f66e5-402d-4027-94a4-39d65680dc78@googlegroups.com> Subject: Re: Efficient Sequential Access to Arrays From: Eryndlia Mavourneen Injection-Date: Mon, 25 Feb 2013 21:18:02 +0000 Content-Type: text/plain; charset=ISO-8859-1 Date: 2013-02-25T13:18:01-08:00 List-Id: On Friday, July 27, 2012 3:21:18 AM UTC-5, Keean Schupke wrote: > > I am wondering if there is a way to use address arithmetic that would be just as safe as array indexing? ... Perhaps something along the lines of: with System, System.Storage_Elements; use System, System.Storage_Elements; package body Keean_Pkg is type Value_Type is limited private; type Index_Type is range <>; type Array_Type is array (Index_Type) of Value_Type; Element_Size : constant Storage_Offset := A'Component_Size / Storage_Unit; Current_A : Address; begin Current_A := Some_Element'Address; -- address of 1st element to be processed Processing_Loop: ... loop Declare_A: declare A : Array_Type; for A'Address use Current_A; begin -- Perform processing on the element of array A ... Current_A := Current_A + Element_Size; end Declare_A; end loop Processing_Loop; end Keean_Pkg;