Description: | Extends the argument with zeros. This function is used primarily for bit-oriented operations. | ||
Class: | Elemental function; Generic | ||
Arguments: | X must be of type logical or integer. | ||
Results: | The result
type is default integer. The result value is X extended with
zeros and treated as an unsigned value.
The storage requirements for integer constants are never less than two bytes. Integer constants within the range of constants that can be represented by a single byte still require two bytes of storage. The setting of compiler options specifying integer size can affect ZEXT. |
Specific Name | Argument Type | Result Type |
---|---|---|
IZEXT | LOGICAL(1) | INTEGER(2) |
LOGICAL(2) | INTEGER(2) | |
INTEGER(1) | INTEGER(2) | |
INTEGER(2) | INTEGER(2) | |
JZEXT | LOGICAL(1) | INTEGER(4) |
LOGICAL(2) | INTEGER(4) | |
LOGICAL(4) | INTEGER(4) | |
INTEGER(1) | INTEGER(4) | |
INTEGER(2) | INTEGER(4) | |
INTEGER(4) | INTEGER(4) | |
KZEXT | LOGICAL(1) | INTEGER(8) |
LOGICAL(2) | INTEGER(8) | |
LOGICAL(4) | INTEGER(8) | |
LOGICAL(8) | INTEGER(8) | |
INTEGER(1) | INTEGER(8) | |
INTEGER(2) | INTEGER(8) | |
INTEGER(4) | INTEGER(8) | |
INTEGER(8) | INTEGER(8) |
Examples
Consider the following example:
This example stores an INTEGER(2) quantity in the low-order 16 bits
of an INTEGER(4) quantity, with the resulting value of L_VAR being
'0000FFFF'X. If the ZEXT function had
not been used, the resulting value would have been
'FFFFFFFF'X, because W_VAR would have been converted to
the left-hand operand's data type by sign extension.
INTEGER(2) W_VAR /'FFFF'X/
INTEGER(4) L_VAR
L_VAR = ZEXT(W_VAR)