Intel® Fortran Compiler 16.0 User and Reference Guide

ZEXT

Elemental Intrinsic Function (Generic): Extends an argument with zeros. This function is used primarily for bit-oriented operations. It cannot be passed as an actual argument.

result = ZEXT (x [,kind])

x

(Input) Must be of type logical or integer.

kind

(Input; optional) Must be a scalar integer initialization expression.

Results

The result type is 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 1

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)

1These specific functions cannot be passed as actual arguments.

Example

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.