9.3.165 ZEXT (X [, KIND])

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. 
  KIND (opt) Must be a scalar integer initialization expression. 
Results:  The result is of type integer. If KIND is present, the kind parameter of the result is that specified by KIND; otherwise, the kind parameter of the result is that of default integer. If the processor cannot represent the result value in the kind of the result, the result is undefined.

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 this function.
 

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:

INTEGER(2) W_VAR /'FFFF'X/
INTEGER(4) L_VAR
L_VAR = ZEXT(W_VAR)

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.


Previous Page Next Page Table of Contents