HP Pascal/iX Programmer's Guide (31502-90023)
A-: 26
Each element of array b requires and is allocated five bits (see Table
A-6 ). The elements are bit-aligned, and the entire array occupies 21
bits. It is allocated four bytes.
To the enumeration-of-subrange field of a packed record, the Pascal/V
packing algorithm allocates the required number of bits. Any allocation
from one bit to two bytes is possible. The field is bit-aligned, but
never crosses a 2-byte boundary.
Example
TYPE
enum_32 = (e1,e2,e3,e4,e5,e6,e7,e8,e9,e10,
e11,e12,e13,e14,e15,e16,e17,e18,e19,e20,
e21,e22,e23,e24,e25,e26,e27,e28,e29,e30,
e31,e32);
VAR
a : PACKED RECORD
f1,f2,f3,f4 : e7..e15;
END;
b : PACKED RECORD
f1,f2,f3,f4 : e24..e31;
END;
Each field of record a requires and is allocated four bits. The fields
are bit-aligned, but cannot cross 2-byte boundaries. The entire record
is allocated two bytes:
Each field of record b requires and is allocated five bits. The fields
are bit-aligned, but cannot cross 2-byte boundaries. The entire record
occupies 21 bits. It is allocated four bytes:
Packed Subranges of Integers.
This subsection explains how the Pascal/V packing algorithm allocates and
aligns packed variables whose types are subranges of integers. These
packed variables are either the elements of packed arrays or the fields
of packed records.
To the integer subrange variable of a packed array or packed record, the
Pascal/V packing algorithm allocates the required number of bits (if the
subrange is, or is included in, -32768..32767) or four bytes (if the
subrange is outside that range).