From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on ip-172-31-65-14.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-3.2 required=3.0 tests=BAYES_00,NICE_REPLY_A, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 Path: eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Ada array contiguity. Date: Sun, 19 Feb 2023 20:05:28 +0100 Organization: A noiseless patient Spider Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Sun, 19 Feb 2023 19:05:27 -0000 (UTC) Injection-Info: reader01.eternal-september.org; posting-host="b688fff65d5e218a4c1e9cadbb53e098"; logging-data="374519"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX197v7jCDwLKeEFEdppfn8G7atKNYMAAI18=" User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Cancel-Lock: sha1:VQ8J2W9e385SBXfYILgY6blHAHo= Content-Language: en-US In-Reply-To: Xref: reader01.eternal-september.org comp.lang.ada:64947 List-Id: On 2023-02-19 18:54, Niklas Holsti wrote: > On 2023-02-19 17:08, Dmitry A. Kazakov wrote: >> Rather: the bit offset of an element is a linear function of its >> position. > > That is ordering by index, but not contiguity: there may still be gaps > between elements. However, I assume you meant that the slope of the > linear function equals the component size, and then it includes contiguity. No gaps = packed = the most dense representation. Contiguity is rather that the gaps are regular and can be considered a part of each element. E.g. a video buffer with strides is not contiguous. > The relationship of index order to memory-location order is certainly an > aspect that should be considered when interfacing to C or HW. An definition of contiguous array equivalent to linearity is that the array body representation is isomorphic to slicing. > Pet peeve: on more than one occasion I have been disappointed that Ada > representation clauses do not let me specify the index-order of packed > array elements in a word, relative to the bit-numbering order, and I > have had to fall back to using several scalar-type record components, c1 > .. c7 say, instead of one array-type component, c(1..7). This is as blasphemous as asking for n-D slices... (:-)) -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de