Debian Codegraph @

gcc/ada/s-pack.adb.tmpl

raw
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT RUN-TIME COMPONENTS --
4 -- --
5 -- S Y S T E M . P A C K _ @ @ --
6 -- --
7 -- B o d y --
8 -- --
9 -- Copyright (C) 1992-2025, Free Software Foundation, Inc. --
10 -- --
11 -- GNAT is free software; you can redistribute it and/or modify it under --
12 -- terms of the GNU General Public License as published by the Free Soft- --
13 -- ware Foundation; either version 3, or (at your option) any later ver- --
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
16 -- or FITNESS FOR A PARTICULAR PURPOSE. --
17 -- --
18 -- As a special exception under Section 7 of GPL version 3, you are granted --
19 -- additional permissions described in the GCC Runtime Library Exception, --
20 -- version 3.1, as published by the Free Software Foundation. --
21 -- --
22 -- You should have received a copy of the GNU General Public License and --
23 -- a copy of the GCC Runtime Library Exception along with this program; --
24 -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
25 -- <http://www.gnu.org/licenses/>. --
26 -- --
27 -- GNAT was originally developed by the GNAT team at New York University. --
28 -- Extensive contributions were provided by Ada Core Technologies Inc. --
29 -- --
30 ------------------------------------------------------------------------------
31
32 with System.Address_To_Access_Conversions;
33 with System.Storage_Elements;
34 with System.Unsigned_Types;
35
36 package body System.Pack_@@ is
37
38 -- The high-level idea of the implementation is to overlay a record
39 -- containing components of the same size as that of the component
40 -- of the array, in other words @@ bits, and to access the indexed
41 -- component of the array through the appropriate selected component
42 -- of the record.
43
44 -- The record must be of a fixed size for technical reasons, so we
45 -- effectively overlay a series of contiguous records containing 8
46 -- components (so that their size in bits is a multiple of a byte)
47 -- at the start of the array and access the component in the last
48 -- of them. However, this component in the last record may also be
49 -- mapped to the last component of the array, which means that the
50 -- generated code cannot safely access past it (or its last byte).
51 -- That's why the last record of the series is shortened, so the
52 -- accessed component is always the last component of the record.
53
54 -- A (0) A (N)
55 -- | |
56 -- V V
57 -- ---------------------------------------------------------------
58 -- | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
59 -- ---------------------------------------------------------------
60 --
61 -- component K
62 -- |
63 -- V
64 -- ---------------------------------------------------------
65 -- | | | | |
66 -- ---------------------------------------------------------
67 -- | | | |
68 -- Cluster7 Cluster7 Cluster7 ClusterK
69 --
70 -- where the number of Cluster7 is N / 8 and K is N mod 8.
71
72 subtype Bit_Order is System.Bit_Order;
73 Reverse_Bit_Order : constant Bit_Order :=
74 Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
75
76 subtype Ofs is System.Storage_Elements.Storage_Offset;
77 subtype Uns is System.Unsigned_Types.Unsigned;
78 subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
79
80 use type System.Storage_Elements.Storage_Offset;
81 use type System.Unsigned_Types.Unsigned;
82
83 --------------
84 -- Cluster0 --
85 --------------
86
87 type Cluster0 is record
88 E0 : Bits_@@;
89 end record;
90
91 for Cluster0 use record
92 E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1;
93 end record;
94
95 for Cluster0'Size use Bits * (1 + 0);
96
97 for Cluster0'Alignment use Integer'Min (Standard'Maximum_Alignment,
98 1 +
99 1 * Boolean'Pos (Bits mod 2 = 0) +
100 2 * Boolean'Pos (Bits mod 4 = 0));
101 -- Use maximum possible alignment, given the bit field size, since this
102 -- will result in the most efficient code possible for the field.
103
104 package AAC0 is new Address_To_Access_Conversions (Cluster0);
105 -- We convert addresses to access values and dereference them instead of
106 -- directly using overlays in order to work around the implementation of
107 -- the RM 13.3(19) clause, which would pessimize the generated code.
108
109 type Rev_Cluster0 is new Cluster0
110 with Bit_Order => Reverse_Bit_Order,
111 Scalar_Storage_Order => Reverse_Bit_Order;
112
113 package Rev_AAC0 is new Address_To_Access_Conversions (Rev_Cluster0);
114
115 @even
116 -- The following declarations are for the case where the address
117 -- passed to GetU_@@ or SetU_@@ is not guaranteed to be aligned.
118 -- These routines are used when the packed array is itself a
119 -- component of a packed record, and therefore may not be aligned.
120
121 type Cluster0U is new Cluster0;
122 for Cluster0U'Alignment use 1;
123
124 package AAC0U is new Address_To_Access_Conversions (Cluster0U);
125
126 type Rev_Cluster0U is new Cluster0U
127 with Bit_Order => Reverse_Bit_Order,
128 Scalar_Storage_Order => Reverse_Bit_Order;
129
130 package Rev_AAC0U is new Address_To_Access_Conversions (Rev_Cluster0U);
131
132 @/even
133 --------------
134 -- Cluster1 --
135 --------------
136
137 type Cluster1 is record
138 E0, E1 : Bits_@@;
139 end record;
140
141 for Cluster1 use record
142 E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1;
143 E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1;
144 end record;
145
146 for Cluster1'Size use Bits * (1 + 1);
147
148 for Cluster1'Alignment use Integer'Min (Standard'Maximum_Alignment,
149 1 +
150 1 * Boolean'Pos (Bits mod 2 = 0) +
151 2 * Boolean'Pos (Bits mod 4 = 0));
152 -- Use maximum possible alignment, given the bit field size, since this
153 -- will result in the most efficient code possible for the field.
154
155 package AAC1 is new Address_To_Access_Conversions (Cluster1);
156 -- We convert addresses to access values and dereference them instead of
157 -- directly using overlays in order to work around the implementation of
158 -- the RM 13.3(19) clause, which would pessimize the generated code.
159
160 type Rev_Cluster1 is new Cluster1
161 with Bit_Order => Reverse_Bit_Order,
162 Scalar_Storage_Order => Reverse_Bit_Order;
163
164 package Rev_AAC1 is new Address_To_Access_Conversions (Rev_Cluster1);
165
166 @even
167 -- The following declarations are for the case where the address
168 -- passed to GetU_@@ or SetU_@@ is not guaranteed to be aligned.
169 -- These routines are used when the packed array is itself a
170 -- component of a packed record, and therefore may not be aligned.
171
172 type Cluster1U is new Cluster1;
173 for Cluster1U'Alignment use 1;
174
175 package AAC1U is new Address_To_Access_Conversions (Cluster1U);
176
177 type Rev_Cluster1U is new Cluster1U
178 with Bit_Order => Reverse_Bit_Order,
179 Scalar_Storage_Order => Reverse_Bit_Order;
180
181 package Rev_AAC1U is new Address_To_Access_Conversions (Rev_Cluster1U);
182
183 @/even
184 --------------
185 -- Cluster2 --
186 --------------
187
188 type Cluster2 is record
189 E0, E1, E2 : Bits_@@;
190 end record;
191
192 for Cluster2 use record
193 E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1;
194 E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1;
195 E2 at 0 range 2 * Bits .. 2 * Bits + Bits - 1;
196 end record;
197
198 for Cluster2'Size use Bits * (1 + 2);
199
200 for Cluster2'Alignment use Integer'Min (Standard'Maximum_Alignment,
201 1 +
202 1 * Boolean'Pos (Bits mod 2 = 0) +
203 2 * Boolean'Pos (Bits mod 4 = 0));
204 -- Use maximum possible alignment, given the bit field size, since this
205 -- will result in the most efficient code possible for the field.
206
207 package AAC2 is new Address_To_Access_Conversions (Cluster2);
208 -- We convert addresses to access values and dereference them instead of
209 -- directly using overlays in order to work around the implementation of
210 -- the RM 13.3(19) clause, which would pessimize the generated code.
211
212 type Rev_Cluster2 is new Cluster2
213 with Bit_Order => Reverse_Bit_Order,
214 Scalar_Storage_Order => Reverse_Bit_Order;
215
216 package Rev_AAC2 is new Address_To_Access_Conversions (Rev_Cluster2);
217
218 @even
219 -- The following declarations are for the case where the address
220 -- passed to GetU_@@ or SetU_@@ is not guaranteed to be aligned.
221 -- These routines are used when the packed array is itself a
222 -- component of a packed record, and therefore may not be aligned.
223
224 type Cluster2U is new Cluster2;
225 for Cluster2U'Alignment use 1;
226
227 package AAC2U is new Address_To_Access_Conversions (Cluster2U);
228
229 type Rev_Cluster2U is new Cluster2U
230 with Bit_Order => Reverse_Bit_Order,
231 Scalar_Storage_Order => Reverse_Bit_Order;
232
233 package Rev_AAC2U is new Address_To_Access_Conversions (Rev_Cluster2U);
234
235 @/even
236 --------------
237 -- Cluster3 --
238 --------------
239
240 type Cluster3 is record
241 E0, E1, E2, E3 : Bits_@@;
242 end record;
243
244 for Cluster3 use record
245 E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1;
246 E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1;
247 E2 at 0 range 2 * Bits .. 2 * Bits + Bits - 1;
248 E3 at 0 range 3 * Bits .. 3 * Bits + Bits - 1;
249 end record;
250
251 for Cluster3'Size use Bits * (1 + 3);
252
253 for Cluster3'Alignment use Integer'Min (Standard'Maximum_Alignment,
254 1 +
255 1 * Boolean'Pos (Bits mod 2 = 0) +
256 2 * Boolean'Pos (Bits mod 4 = 0));
257 -- Use maximum possible alignment, given the bit field size, since this
258 -- will result in the most efficient code possible for the field.
259
260 package AAC3 is new Address_To_Access_Conversions (Cluster3);
261 -- We convert addresses to access values and dereference them instead of
262 -- directly using overlays in order to work around the implementation of
263 -- the RM 13.3(19) clause, which would pessimize the generated code.
264
265 type Rev_Cluster3 is new Cluster3
266 with Bit_Order => Reverse_Bit_Order,
267 Scalar_Storage_Order => Reverse_Bit_Order;
268
269 package Rev_AAC3 is new Address_To_Access_Conversions (Rev_Cluster3);
270
271 @even
272 -- The following declarations are for the case where the address
273 -- passed to GetU_@@ or SetU_@@ is not guaranteed to be aligned.
274 -- These routines are used when the packed array is itself a
275 -- component of a packed record, and therefore may not be aligned.
276
277 type Cluster3U is new Cluster3;
278 for Cluster3U'Alignment use 1;
279
280 package AAC3U is new Address_To_Access_Conversions (Cluster3U);
281
282 type Rev_Cluster3U is new Cluster3U
283 with Bit_Order => Reverse_Bit_Order,
284 Scalar_Storage_Order => Reverse_Bit_Order;
285
286 package Rev_AAC3U is new Address_To_Access_Conversions (Rev_Cluster3U);
287
288 @/even
289 --------------
290 -- Cluster4 --
291 --------------
292
293 type Cluster4 is record
294 E0, E1, E2, E3, E4 : Bits_@@;
295 end record;
296
297 for Cluster4 use record
298 E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1;
299 E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1;
300 E2 at 0 range 2 * Bits .. 2 * Bits + Bits - 1;
301 E3 at 0 range 3 * Bits .. 3 * Bits + Bits - 1;
302 E4 at 0 range 4 * Bits .. 4 * Bits + Bits - 1;
303 end record;
304
305 for Cluster4'Size use Bits * (1 + 4);
306
307 for Cluster4'Alignment use Integer'Min (Standard'Maximum_Alignment,
308 1 +
309 1 * Boolean'Pos (Bits mod 2 = 0) +
310 2 * Boolean'Pos (Bits mod 4 = 0));
311 -- Use maximum possible alignment, given the bit field size, since this
312 -- will result in the most efficient code possible for the field.
313
314 package AAC4 is new Address_To_Access_Conversions (Cluster4);
315 -- We convert addresses to access values and dereference them instead of
316 -- directly using overlays in order to work around the implementation of
317 -- the RM 13.3(19) clause, which would pessimize the generated code.
318
319 type Rev_Cluster4 is new Cluster4
320 with Bit_Order => Reverse_Bit_Order,
321 Scalar_Storage_Order => Reverse_Bit_Order;
322
323 package Rev_AAC4 is new Address_To_Access_Conversions (Rev_Cluster4);
324
325 @even
326 -- The following declarations are for the case where the address
327 -- passed to GetU_@@ or SetU_@@ is not guaranteed to be aligned.
328 -- These routines are used when the packed array is itself a
329 -- component of a packed record, and therefore may not be aligned.
330
331 type Cluster4U is new Cluster4;
332 for Cluster4U'Alignment use 1;
333
334 package AAC4U is new Address_To_Access_Conversions (Cluster4U);
335
336 type Rev_Cluster4U is new Cluster4U
337 with Bit_Order => Reverse_Bit_Order,
338 Scalar_Storage_Order => Reverse_Bit_Order;
339
340 package Rev_AAC4U is new Address_To_Access_Conversions (Rev_Cluster4U);
341
342 @/even
343 --------------
344 -- Cluster5 --
345 --------------
346
347 type Cluster5 is record
348 E0, E1, E2, E3, E4, E5 : Bits_@@;
349 end record;
350
351 for Cluster5 use record
352 E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1;
353 E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1;
354 E2 at 0 range 2 * Bits .. 2 * Bits + Bits - 1;
355 E3 at 0 range 3 * Bits .. 3 * Bits + Bits - 1;
356 E4 at 0 range 4 * Bits .. 4 * Bits + Bits - 1;
357 E5 at 0 range 5 * Bits .. 5 * Bits + Bits - 1;
358 end record;
359
360 for Cluster5'Size use Bits * (1 + 5);
361
362 for Cluster5'Alignment use Integer'Min (Standard'Maximum_Alignment,
363 1 +
364 1 * Boolean'Pos (Bits mod 2 = 0) +
365 2 * Boolean'Pos (Bits mod 4 = 0));
366 -- Use maximum possible alignment, given the bit field size, since this
367 -- will result in the most efficient code possible for the field.
368
369 package AAC5 is new Address_To_Access_Conversions (Cluster5);
370 -- We convert addresses to access values and dereference them instead of
371 -- directly using overlays in order to work around the implementation of
372 -- the RM 13.3(19) clause, which would pessimize the generated code.
373
374 type Rev_Cluster5 is new Cluster5
375 with Bit_Order => Reverse_Bit_Order,
376 Scalar_Storage_Order => Reverse_Bit_Order;
377
378 package Rev_AAC5 is new Address_To_Access_Conversions (Rev_Cluster5);
379
380 @even
381 -- The following declarations are for the case where the address
382 -- passed to GetU_@@ or SetU_@@ is not guaranteed to be aligned.
383 -- These routines are used when the packed array is itself a
384 -- component of a packed record, and therefore may not be aligned.
385
386 type Cluster5U is new Cluster5;
387 for Cluster5U'Alignment use 1;
388
389 package AAC5U is new Address_To_Access_Conversions (Cluster5U);
390
391 type Rev_Cluster5U is new Cluster5U
392 with Bit_Order => Reverse_Bit_Order,
393 Scalar_Storage_Order => Reverse_Bit_Order;
394
395 package Rev_AAC5U is new Address_To_Access_Conversions (Rev_Cluster5U);
396
397 @/even
398 --------------
399 -- Cluster6 --
400 --------------
401
402 type Cluster6 is record
403 E0, E1, E2, E3, E4, E5, E6 : Bits_@@;
404 end record;
405
406 for Cluster6 use record
407 E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1;
408 E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1;
409 E2 at 0 range 2 * Bits .. 2 * Bits + Bits - 1;
410 E3 at 0 range 3 * Bits .. 3 * Bits + Bits - 1;
411 E4 at 0 range 4 * Bits .. 4 * Bits + Bits - 1;
412 E5 at 0 range 5 * Bits .. 5 * Bits + Bits - 1;
413 E6 at 0 range 6 * Bits .. 6 * Bits + Bits - 1;
414 end record;
415
416 for Cluster6'Size use Bits * (1 + 6);
417
418 for Cluster6'Alignment use Integer'Min (Standard'Maximum_Alignment,
419 1 +
420 1 * Boolean'Pos (Bits mod 2 = 0) +
421 2 * Boolean'Pos (Bits mod 4 = 0));
422 -- Use maximum possible alignment, given the bit field size, since this
423 -- will result in the most efficient code possible for the field.
424
425 package AAC6 is new Address_To_Access_Conversions (Cluster6);
426 -- We convert addresses to access values and dereference them instead of
427 -- directly using overlays in order to work around the implementation of
428 -- the RM 13.3(19) clause, which would pessimize the generated code.
429
430 type Rev_Cluster6 is new Cluster6
431 with Bit_Order => Reverse_Bit_Order,
432 Scalar_Storage_Order => Reverse_Bit_Order;
433
434 package Rev_AAC6 is new Address_To_Access_Conversions (Rev_Cluster6);
435
436 @even
437 -- The following declarations are for the case where the address
438 -- passed to GetU_@@ or SetU_@@ is not guaranteed to be aligned.
439 -- These routines are used when the packed array is itself a
440 -- component of a packed record, and therefore may not be aligned.
441
442 type Cluster6U is new Cluster6;
443 for Cluster6U'Alignment use 1;
444
445 package AAC6U is new Address_To_Access_Conversions (Cluster6U);
446
447 type Rev_Cluster6U is new Cluster6U
448 with Bit_Order => Reverse_Bit_Order,
449 Scalar_Storage_Order => Reverse_Bit_Order;
450
451 package Rev_AAC6U is new Address_To_Access_Conversions (Rev_Cluster6U);
452
453 @/even
454 --------------
455 -- Cluster7 --
456 --------------
457
458 type Cluster7 is record
459 E0, E1, E2, E3, E4, E5, E6, E7 : Bits_@@;
460 end record;
461
462 for Cluster7 use record
463 E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1;
464 E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1;
465 E2 at 0 range 2 * Bits .. 2 * Bits + Bits - 1;
466 E3 at 0 range 3 * Bits .. 3 * Bits + Bits - 1;
467 E4 at 0 range 4 * Bits .. 4 * Bits + Bits - 1;
468 E5 at 0 range 5 * Bits .. 5 * Bits + Bits - 1;
469 E6 at 0 range 6 * Bits .. 6 * Bits + Bits - 1;
470 E7 at 0 range 7 * Bits .. 7 * Bits + Bits - 1;
471 end record;
472
473 for Cluster7'Size use Bits * (1 + 7);
474
475 for Cluster7'Alignment use Integer'Min (Standard'Maximum_Alignment,
476 1 +
477 1 * Boolean'Pos (Bits mod 2 = 0) +
478 2 * Boolean'Pos (Bits mod 4 = 0));
479 -- Use maximum possible alignment, given the bit field size, since this
480 -- will result in the most efficient code possible for the field.
481
482 package AAC7 is new Address_To_Access_Conversions (Cluster7);
483 -- We convert addresses to access values and dereference them instead of
484 -- directly using overlays in order to work around the implementation of
485 -- the RM 13.3(19) clause, which would pessimize the generated code.
486
487 type Rev_Cluster7 is new Cluster7
488 with Bit_Order => Reverse_Bit_Order,
489 Scalar_Storage_Order => Reverse_Bit_Order;
490
491 package Rev_AAC7 is new Address_To_Access_Conversions (Rev_Cluster7);
492
493 @even
494 -- The following declarations are for the case where the address
495 -- passed to GetU_@@ or SetU_@@ is not guaranteed to be aligned.
496 -- These routines are used when the packed array is itself a
497 -- component of a packed record, and therefore may not be aligned.
498
499 type Cluster7U is new Cluster7;
500 for Cluster7U'Alignment use 1;
501
502 package AAC7U is new Address_To_Access_Conversions (Cluster7U);
503
504 type Rev_Cluster7U is new Cluster7U
505 with Bit_Order => Reverse_Bit_Order,
506 Scalar_Storage_Order => Reverse_Bit_Order;
507
508 package Rev_AAC7U is new Address_To_Access_Conversions (Rev_Cluster7U);
509
510 @/even
511 ------------
512 -- Get_@@ --
513 ------------
514
515 function Get_@@
516 (Arr : System.Address;
517 N : Natural;
518 Rev_SSO : Boolean) return Bits_@@
519 is
520 A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
521 C0 : constant AAC0.Object_Pointer := AAC0.To_Pointer (A);
522 C1 : constant AAC1.Object_Pointer := AAC1.To_Pointer (A);
523 C2 : constant AAC2.Object_Pointer := AAC2.To_Pointer (A);
524 C3 : constant AAC3.Object_Pointer := AAC3.To_Pointer (A);
525 C4 : constant AAC4.Object_Pointer := AAC4.To_Pointer (A);
526 C5 : constant AAC5.Object_Pointer := AAC5.To_Pointer (A);
527 C6 : constant AAC6.Object_Pointer := AAC6.To_Pointer (A);
528 C7 : constant AAC7.Object_Pointer := AAC7.To_Pointer (A);
529 RC0 : constant Rev_AAC0.Object_Pointer := Rev_AAC0.To_Pointer (A);
530 RC1 : constant Rev_AAC1.Object_Pointer := Rev_AAC1.To_Pointer (A);
531 RC2 : constant Rev_AAC2.Object_Pointer := Rev_AAC2.To_Pointer (A);
532 RC3 : constant Rev_AAC3.Object_Pointer := Rev_AAC3.To_Pointer (A);
533 RC4 : constant Rev_AAC4.Object_Pointer := Rev_AAC4.To_Pointer (A);
534 RC5 : constant Rev_AAC5.Object_Pointer := Rev_AAC5.To_Pointer (A);
535 RC6 : constant Rev_AAC6.Object_Pointer := Rev_AAC6.To_Pointer (A);
536 RC7 : constant Rev_AAC7.Object_Pointer := Rev_AAC7.To_Pointer (A);
537
538 begin
539 return
540 (if Rev_SSO then
541 (case N07 (Uns (N) mod 8) is
542 when 0 => RC0.E0,
543 when 1 => RC1.E1,
544 when 2 => RC2.E2,
545 when 3 => RC3.E3,
546 when 4 => RC4.E4,
547 when 5 => RC5.E5,
548 when 6 => RC6.E6,
549 when 7 => RC7.E7)
550
551 else
552 (case N07 (Uns (N) mod 8) is
553 when 0 => C0.E0,
554 when 1 => C1.E1,
555 when 2 => C2.E2,
556 when 3 => C3.E3,
557 when 4 => C4.E4,
558 when 5 => C5.E5,
559 when 6 => C6.E6,
560 when 7 => C7.E7)
561 );
562 end Get_@@;
563
564 @even
565 -------------
566 -- GetU_@@ --
567 -------------
568
569 function GetU_@@
570 (Arr : System.Address;
571 N : Natural;
572 Rev_SSO : Boolean) return Bits_@@
573 is
574 A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
575 C0 : constant AAC0U.Object_Pointer := AAC0U.To_Pointer (A);
576 C1 : constant AAC1U.Object_Pointer := AAC1U.To_Pointer (A);
577 C2 : constant AAC2U.Object_Pointer := AAC2U.To_Pointer (A);
578 C3 : constant AAC3U.Object_Pointer := AAC3U.To_Pointer (A);
579 C4 : constant AAC4U.Object_Pointer := AAC4U.To_Pointer (A);
580 C5 : constant AAC5U.Object_Pointer := AAC5U.To_Pointer (A);
581 C6 : constant AAC6U.Object_Pointer := AAC6U.To_Pointer (A);
582 C7 : constant AAC7U.Object_Pointer := AAC7U.To_Pointer (A);
583 RC0 : constant Rev_AAC0U.Object_Pointer := Rev_AAC0U.To_Pointer (A);
584 RC1 : constant Rev_AAC1U.Object_Pointer := Rev_AAC1U.To_Pointer (A);
585 RC2 : constant Rev_AAC2U.Object_Pointer := Rev_AAC2U.To_Pointer (A);
586 RC3 : constant Rev_AAC3U.Object_Pointer := Rev_AAC3U.To_Pointer (A);
587 RC4 : constant Rev_AAC4U.Object_Pointer := Rev_AAC4U.To_Pointer (A);
588 RC5 : constant Rev_AAC5U.Object_Pointer := Rev_AAC5U.To_Pointer (A);
589 RC6 : constant Rev_AAC6U.Object_Pointer := Rev_AAC6U.To_Pointer (A);
590 RC7 : constant Rev_AAC7U.Object_Pointer := Rev_AAC7U.To_Pointer (A);
591
592 begin
593 return
594 (if Rev_SSO then
595 (case N07 (Uns (N) mod 8) is
596 when 0 => RC0.E0,
597 when 1 => RC1.E1,
598 when 2 => RC2.E2,
599 when 3 => RC3.E3,
600 when 4 => RC4.E4,
601 when 5 => RC5.E5,
602 when 6 => RC6.E6,
603 when 7 => RC7.E7)
604
605 else
606 (case N07 (Uns (N) mod 8) is
607 when 0 => C0.E0,
608 when 1 => C1.E1,
609 when 2 => C2.E2,
610 when 3 => C3.E3,
611 when 4 => C4.E4,
612 when 5 => C5.E5,
613 when 6 => C6.E6,
614 when 7 => C7.E7)
615 );
616 end GetU_@@;
617
618 @/even
619 ------------
620 -- Set_@@ --
621 ------------
622
623 procedure Set_@@
624 (Arr : System.Address;
625 N : Natural;
626 E : Bits_@@;
627 Rev_SSO : Boolean)
628 is
629 A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
630 C0 : constant AAC0.Object_Pointer := AAC0.To_Pointer (A);
631 C1 : constant AAC1.Object_Pointer := AAC1.To_Pointer (A);
632 C2 : constant AAC2.Object_Pointer := AAC2.To_Pointer (A);
633 C3 : constant AAC3.Object_Pointer := AAC3.To_Pointer (A);
634 C4 : constant AAC4.Object_Pointer := AAC4.To_Pointer (A);
635 C5 : constant AAC5.Object_Pointer := AAC5.To_Pointer (A);
636 C6 : constant AAC6.Object_Pointer := AAC6.To_Pointer (A);
637 C7 : constant AAC7.Object_Pointer := AAC7.To_Pointer (A);
638 RC0 : constant Rev_AAC0.Object_Pointer := Rev_AAC0.To_Pointer (A);
639 RC1 : constant Rev_AAC1.Object_Pointer := Rev_AAC1.To_Pointer (A);
640 RC2 : constant Rev_AAC2.Object_Pointer := Rev_AAC2.To_Pointer (A);
641 RC3 : constant Rev_AAC3.Object_Pointer := Rev_AAC3.To_Pointer (A);
642 RC4 : constant Rev_AAC4.Object_Pointer := Rev_AAC4.To_Pointer (A);
643 RC5 : constant Rev_AAC5.Object_Pointer := Rev_AAC5.To_Pointer (A);
644 RC6 : constant Rev_AAC6.Object_Pointer := Rev_AAC6.To_Pointer (A);
645 RC7 : constant Rev_AAC7.Object_Pointer := Rev_AAC7.To_Pointer (A);
646
647 begin
648 if Rev_SSO then
649 case N07 (Uns (N) mod 8) is
650 when 0 => RC0.E0 := E;
651 when 1 => RC1.E1 := E;
652 when 2 => RC2.E2 := E;
653 when 3 => RC3.E3 := E;
654 when 4 => RC4.E4 := E;
655 when 5 => RC5.E5 := E;
656 when 6 => RC6.E6 := E;
657 when 7 => RC7.E7 := E;
658 end case;
659 else
660 case N07 (Uns (N) mod 8) is
661 when 0 => C0.E0 := E;
662 when 1 => C1.E1 := E;
663 when 2 => C2.E2 := E;
664 when 3 => C3.E3 := E;
665 when 4 => C4.E4 := E;
666 when 5 => C5.E5 := E;
667 when 6 => C6.E6 := E;
668 when 7 => C7.E7 := E;
669 end case;
670 end if;
671 end Set_@@;
672
673 @even
674 -------------
675 -- SetU_@@ --
676 -------------
677
678 procedure SetU_@@
679 (Arr : System.Address;
680 N : Natural;
681 E : Bits_@@;
682 Rev_SSO : Boolean)
683 is
684 A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
685 C0 : constant AAC0U.Object_Pointer := AAC0U.To_Pointer (A);
686 C1 : constant AAC1U.Object_Pointer := AAC1U.To_Pointer (A);
687 C2 : constant AAC2U.Object_Pointer := AAC2U.To_Pointer (A);
688 C3 : constant AAC3U.Object_Pointer := AAC3U.To_Pointer (A);
689 C4 : constant AAC4U.Object_Pointer := AAC4U.To_Pointer (A);
690 C5 : constant AAC5U.Object_Pointer := AAC5U.To_Pointer (A);
691 C6 : constant AAC6U.Object_Pointer := AAC6U.To_Pointer (A);
692 C7 : constant AAC7U.Object_Pointer := AAC7U.To_Pointer (A);
693 RC0 : constant Rev_AAC0U.Object_Pointer := Rev_AAC0U.To_Pointer (A);
694 RC1 : constant Rev_AAC1U.Object_Pointer := Rev_AAC1U.To_Pointer (A);
695 RC2 : constant Rev_AAC2U.Object_Pointer := Rev_AAC2U.To_Pointer (A);
696 RC3 : constant Rev_AAC3U.Object_Pointer := Rev_AAC3U.To_Pointer (A);
697 RC4 : constant Rev_AAC4U.Object_Pointer := Rev_AAC4U.To_Pointer (A);
698 RC5 : constant Rev_AAC5U.Object_Pointer := Rev_AAC5U.To_Pointer (A);
699 RC6 : constant Rev_AAC6U.Object_Pointer := Rev_AAC6U.To_Pointer (A);
700 RC7 : constant Rev_AAC7U.Object_Pointer := Rev_AAC7U.To_Pointer (A);
701
702 begin
703 if Rev_SSO then
704 case N07 (Uns (N) mod 8) is
705 when 0 => RC0.E0 := E;
706 when 1 => RC1.E1 := E;
707 when 2 => RC2.E2 := E;
708 when 3 => RC3.E3 := E;
709 when 4 => RC4.E4 := E;
710 when 5 => RC5.E5 := E;
711 when 6 => RC6.E6 := E;
712 when 7 => RC7.E7 := E;
713 end case;
714 else
715 case N07 (Uns (N) mod 8) is
716 when 0 => C0.E0 := E;
717 when 1 => C1.E1 := E;
718 when 2 => C2.E2 := E;
719 when 3 => C3.E3 := E;
720 when 4 => C4.E4 := E;
721 when 5 => C5.E5 := E;
722 when 6 => C6.E6 := E;
723 when 7 => C7.E7 := E;
724 end case;
725 end if;
726 end SetU_@@;
727
728 @/even
729 end System.Pack_@@;