The ISHFT function performs the bit shift operation on bytes, integers and longwords.


Bit shift each element of the integer array [1, 2, 3, 4, 5] three bits to the left and store the result in B by entering:

B = ISHFT([1,2,3,4,5], 3)

The resulting array B is [8, 16, 24, 32, 40].


Result = ISHFT(P1, P2)

Return Value

If P2 is positive, P1 is left shifted P2 bit positions with 0 bits filling vacated positions. If P2 is negative, P1 is right shifted with 0 bits filling vacated positions.



The scalar or array to be shifted.


The scalar or array containing the number of bit positions and direction of the shift.


Thread Pool Keywords

This routine is written to make use of IDL’s thread pool, which can increase execution speed on systems with multiple CPUs. The values stored in the !CPU system variable control whether IDL uses the thread pool for a given computation. In addition, you can use the thread pool keywords TPOOL_MAX_ELTS, TPOOL_MIN_ELTS, and TPOOL_NOTHREAD to override the defaults established by !CPU for a single invocation of this routine. See Thread Pool Keywords for details.

Version History



See Also

Bitwise Operators, BIT_POPULATION, SHIFT, IDL_Variable::FromBits, IDL_Variable::ToBits