Reference Guide > I–L Routines > ISHFT Function
  

ISHFT Function
Performs the bit shift operation on BYTE, INT, INT32, and LONG PV‑WAVE data types.
Usage
result = ISHFT(p1, p2)
Input Parameters
p1—The scalar or array to be shifted.
p2The scalar containing the number of bit positions and direction of the shift.
Returned Value
result—The shifted scalar or array value.
Keywords
None.
Discussion
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, again with 0 bits filling vacated positions.
Example
In this example, ISHFT is used to multiply and divide each element of a five-element vector by powers of 2.
; Create and initialize a five-element byte array.
a = BYTARR(5)
FOR i=0L, 4 DO a(i) = 4 * i
PRINT, a
; PV-WAVE prints: 0   4   8   12   16
PRINT, a, ISHFT(a, -2)
; PV-WAVE prints:
; 0   4   8   12   16
; 0   1   2   3    4
PRINT, a, ISHFT(a, 1)
; PV-WAVE prints:
; 0   4    8   12   16
; 0   8   16   24   32
See Also
SHIFT

Version 2017.0
Copyright © 2017, Rogue Wave Software, Inc. All Rights Reserved.