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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,2c498d4a35691643 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!g49g2000cwa.googlegroups.com!not-for-mail From: "jimmaureenrogers@worldnet.att.net" Newsgroups: comp.lang.ada Subject: Re: Allocated aligned arrays Date: 18 Nov 2005 14:06:00 -0800 Organization: http://groups.google.com Message-ID: <1132351560.528877.151360@g49g2000cwa.googlegroups.com> References: <1132349753.719540.119910@g44g2000cwa.googlegroups.com> NNTP-Posting-Host: 209.194.156.4 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1132351565 3164 127.0.0.1 (18 Nov 2005 22:06:05 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 18 Nov 2005 22:06:05 +0000 (UTC) User-Agent: G2/0.2 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0),gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: g49g2000cwa.googlegroups.com; posting-host=209.194.156.4; posting-account=SqOfxAwAAAAkL81YAPGH1JdBwpUXw9ZG Xref: g2news1.google.com comp.lang.ada:6469 Date: 2005-11-18T14:06:00-08:00 List-Id: ldb wrote: > I'm trying to allocate two floating point (4 bytes each) arrays that > are both address-aligned to 16. Ideally, the first element of each > array is aligned on 16 (ie, the address mod 16 = 0), but that's not > really necessary, as long as they are both aligned to the same mod 16 > (i don't care if the first element is 8 or 12 or whatever, as long as > both arrays have the same). > > I'm trying to set up these arrays so I can use aligned SSE instructions > in assembly. > > I have tried something along the lines of: > > type Matrix is array (INTEGER range <>, INTEGER range <>) of float; > for Matrix'Alignment use 16; > > > and then, for an input of 0..200 by 0..200 > > sam := new Matrix(0..200,2..198) > bob := new Matrix(2..198,2..198); > > > These are the actual indicies I would use (it's an image processing > algorithm that trims the edges). I'm not sure if the strange indices > could be causing the problem, but I cannot imagine it is. > > However, the three matricies, input, sam, and bob aren't necessarily > aligned (for certain input index ranges they are, by default, and some > times they are not. The alignment statement I am using seems to have no > effect). You may specify alignment only for the first subtype of a base type. Thus, you may want to define a new type: type Real is new float; for Real'Alignment use 16; The AARM contains the following bit of wisdom: "The Alignment of a composite object is always equal to the least common multiple of the Alignments of its components, or a multiple thereof." Jim Rogers