Skip to content

Commit a365e7e

Browse files
committed
Close #2, close #3, close #4.
1 parent e089490 commit a365e7e

File tree

1 file changed

+28
-16
lines changed

1 file changed

+28
-16
lines changed

draft-ietf-cbor-array-tags.md

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -217,23 +217,31 @@ even when a Typed Array does not apply.
217217
Multi-dimensional Array
218218
-----------------------
219219

220+
A multi-dimensional array is represented as a tagged array that
221+
contains two (one-dimensional) arrays. The first array defines the
222+
dimensions of the
223+
multi-dimensional array (in the sequence of outer dimensions towards
224+
inner dimensions) while the second array represents the contents
225+
of the multi-dimensional array. If the second array is itself tagged
226+
as a Typed Array then the element type of the multi-dimensional array
227+
is known to be the same type as that of the Typed Array.
228+
229+
Two tags are defined by this document, one for elements arranged in
230+
row-major order, and one for column-major order.
231+
232+
### Row-major Order
233+
220234
Tag:
221235
: 40
222236

223237
Data Item:
224238
: array (major type 4) of two arrays, one array (major type 4) of
225-
dimensions, and one array (major type 4, a Typed Array, or a
239+
dimensions, which are unsigned integers distinct from zero, and one
240+
array (either a CBOR array of major type 4, or a Typed Array, or a
226241
Homogeneous Array) of elements
227242

228-
A multi-dimensional array is represented as a tagged array that
229-
contains two (one-dimensional) arrays. The first array defines the dimensions of the
230-
multi-dimensional array (in the sequence of outer dimensions towards
231-
inner dimensions) while the second array represents the contents
232-
of the multi-dimensional array. If the second array is itself tagged
233-
as a Typed Array then the element type of the multi-dimensional array
234-
is known to be the same type as that of the Typed Array. Data in
235-
the Typed Array byte string consists of consecutive values where the
236-
last dimension is considered contiguous (row-major order).
243+
Data in the second array consists of consecutive values where the last
244+
dimension is considered contiguous (row-major order).
237245

238246
{{ex-multidim}} shows a declaration of a two-dimensional array in the
239247
C language, a representation of that in CBOR using both a
@@ -282,17 +290,21 @@ shorter).
282290
~~~
283291
{: #ex-multidim1 title="Multi-dimensional array using basic CBOR array"}
284292

293+
### Column-Major order
294+
295+
The multidimensional arrays specified in the previous
296+
sub-subsection are in "row major" order, which is the preferred order
297+
for the purposes of this specification. An analogous representation
298+
that uses "column major" order arrays is provided in this subsection
299+
under the tag 1040, as illustrated in {{ex-multidim2}}.
285300

286301
Tag:
287302
: 1040
288303

289304
Data Item:
290-
: as with tag 40
291-
292-
Note that above arrays are in "row major" order, which is the
293-
preferred order for the purposes of this specification. An analogous
294-
representation that uses "column major" order arrays is provided under
295-
the tag 1040, as illustrated in {{ex-multidim2}}.
305+
: as with tag 40, except that the data in the second array consists of
306+
consecutive values where the first dimension is considered contiguous
307+
(column-major order).
296308

297309
~~~
298310
<Tag 1040> # multi-dimensional array tag, column major order

0 commit comments

Comments
 (0)