pTAL Reference Manual (G06.24+, H06.09+, J06.03+)
NopTAL privileged procedure
NoCan be executed only by privileged procedures
YesSets condition code
NoSets $CARRY
NoSets $OVERFLOW
expression
is an expression whose value is a BADDR address.
The result of $BADDR_TO_WADDR is undefined if the least significant bit of expression is 1.
The least significant bit of an address is not truncated when a byte address is converted to a word
address—the address is not rounded down to the preceding even-byte address.
Example 236 $BADDR_TO_WADDR Routine
INT .i;
STRING s;
@i := $BADDR_TO_WADDR(@s); ! @s is a BADDR address
$BITLENGTH
$BITLENGTH returns an INT value that is the length, in bits, of a variable.
NopTAL privileged procedure
NoCan be executed only by privileged procedures
NoSets condition code
NoSets $CARRY
NoSets $OVERFLOW
variable
is the identifier of a simple variable, array element, pointer, structure, or structure data item.
$BITLENGTH returns the length, in bits, of a single occurrence of a simple variable, array element,
structure, structure item, or item to which a pointer points.
The length of a structure or substructure occurrence is the sum of the lengths of all items contained
in the structure or substructure. Complete the structure before you use $BITLENGTH to obtain the
length of any of the items in the structure.
To compute the total number of bits in an entire array or substructure, multiply the value returned
by $BITLENGTH by the value returned by $OCCURS. To compute the total number of bits in a
structure, first round up the value returned by $BITLENGTH to the word boundary and then multiply
the rounded value by the value returned by $OCCURS.
You can use $BITLENGTH in LITERAL expressions and global initializations, because it always
returns a constant value.
Nonatomic Operations 295