Previous Topic Next topic Print topic


Bit (n)

Bit (n) is a bit-string variable where n is an integer valued expression that specifies the length of the string value held by the variable. Bit (n) is a sequence of binary digits (bits) that always occupies exactly n bits of storage.

For Intel platforms, using the -bitsltr compiler option stores bit strings as Big-Endian. See -bitsltr in the Compiler Options help topic for more information.

Big-endian platforms:

If the high-order bit of the bit-string does not occur on a byte boundary, the remaining bits in the last byte might be part of another bit-string variable. Within each byte, the bits of the string are stored from the low-order to the high-order bit position. Note the bit positions are zero-relative similar to the hardware bit-numbering. For example, Bit (23) would be stored as follows (assuming an unaligned starting bit offset of 5):

Little-endian platforms:

If the low-order bit of the bit-string does not occur on a byte boundary, the remaining bits in the last byte might be part of another bit-string variable. Within each byte, the bits of the string are stored from the low-order to the high-order bit position (on Intel platforms). Note the bit positions are zero-relative similar to the hardware bit-numbering. For example, Bit (23) would be stored as follows (assuming an unaligned starting bit offset of 5):

On little-endian platforms, bit-strings are essentially stored "right-to-left" according the Intel hardware bit-ordering, but all bit operations are performed according to PL/I language semantics.

Note: Overlaying fixed bin and bit items is non-portable between big-endian and little-endian architectures.
Size Alignment
n bits    bit (none)
Previous Topic Next topic Print topic