pTAL Reference Manual (H06.08+)
Structures
HP pTAL Reference Manual—523746-006
9-26
Structure Length
By rearranging the order of the fields, s3 requires 24 bytes, rather than the 32 bytes
required by s2, even though the information in s3 and s2 is the same. s3 uses only
six more bytes than s1.
Structure Length
The total number of bytes in a SHARED8 structure must be an integral multiple of the
widest field in the structure. If needed, you must explicitly declare filler at the end of a
SHARED8 structure to ensure this condition.
UNSIGNED(1-16) fields cannot cross an even-byte address.
In Example 9-20
on page 9-26, u1 starts at the beginning of the structure. u2,
therefore, would begin at a 10-bit offset from the beginning of s. Because u2 is 16 bits,
the last ten bits of u2 would be allocated in a second word, which would cause u2 to
cross an even-byte address; therefore, you must explicitly declare filler to force u2 to
begin at the next even-byte offset from the beginning of s.
Example 9-18. Structures That Need Filler
STRUCT s1 FIELDALIGN(SHARED8);
BEGIN
FIXED i; ! Structure's widest field is 8 bytes
INT(32) j; ! j is 4 bytes FILLER 4
FILLER 4; ! Pad with 4 bytes
END;
STRUCT s2 FIELDALIGN(SHARED8);
BEGIN
INT(32) i; ! Structure's widest field is 4 bytes
INT j; ! j is 2 bytes
FILLER 2; ! Pad with 2 bytes
END;
Example 9-19. Structure Field Crossing an Even-Byte Address (Error)
STRUCT s FIELDALIGN(SHARED8);
BEGIN
UNSIGNED(10) u1;
UNSIGNED(16) u2; ! Invalid field -- crosses even-byte address
END;
Example 9-20. Structure That Needs Filler
STRUCT s FIELDALIGN(SHARED8);
BEGIN
UNSIGNED(10) u1;
BIT_FILLER 6; ! Forces u2 to begin at next even-byte
! address
UNSIGNED(16) u2;
END;










