HP Pascal/iX Programmer's Guide (31502-90023)
A-: 22
Packed Enumerations.
This subsection explains how the Pascal/V packing algorithm allocates and
aligns packed enumeration variables. A packed enumeration variable is
either the element of a packed array or the field of a packed record.
The algorithm treats the two cases differently.
Table A-6 shows the relationship between the number of bits that an
enumeration element of a packed array requires, the number of bits that
the Pascal/V packing algorithm allocates it, and its alignment. A
bit-aligned element never crosses a 2-byte boundary.
Table A-6. Allocation and Alignment of Enumeration Elements of Packed Arrays
(Pascal/V Packing Algorithm)
-------------------------------------------------------------------------------------
| | | |
| Required Number of Bits | Number of Bits Allocated | Element Alignment |
| Per Element | Per Element | |
| | | |
-------------------------------------------------------------------------------------
| | | |
| 1 | 1 | Bit |
| | | |
-------------------------------------------------------------------------------------
| | | |
| 2 | 2 | Bit |
| | | |
-------------------------------------------------------------------------------------
| | | |
| 3 | 3 | Bit |
| | | |
-------------------------------------------------------------------------------------
| | | |
| 4 | 4 | Bit |
| | | |
-------------------------------------------------------------------------------------
| | | |
| 5 | 5 | Bit |
| | | |
-------------------------------------------------------------------------------------
| | | |
| 6 to 8 | 8 (1 byte) | Byte |
| | | |
-------------------------------------------------------------------------------------
| | | |
| 9 to 16 | 16 (2 bytes) | 2-byte |
| | | |
-------------------------------------------------------------------------------------
Table A-7 shows the relationship between the number of bits that an
enumeration field of a packed record requires, the number of bits that
the Pascal/V mapping algorithm allocates it, and its alignment. A
bit-aligned field never crosses a 2-byte boundary.