comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Ada array contiguity.
Date: Sun, 19 Feb 2023 20:05:28 +0100	[thread overview]
Message-ID: <tstrtn$bdnn$3@dont-email.me> (raw)
In-Reply-To: <k5f625F5lhmU3@mid.individual.net>

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

  reply	other threads:[~2023-02-19 19:05 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-19 13:34 Ada array contiguity Rod Kay
2023-02-19 14:28 ` J-P. Rosen
2023-02-19 14:59   ` Niklas Holsti
2023-02-19 15:08     ` Dmitry A. Kazakov
2023-02-19 17:10     ` J-P. Rosen
2023-02-19 17:54       ` Niklas Holsti
2023-02-19 19:05         ` Dmitry A. Kazakov [this message]
2023-02-20  7:12         ` J-P. Rosen
2023-02-19 22:02 ` Jeffrey R.Carter
2023-03-01 13:22 ` Rod Kay
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox