SHIFTA intrinsic function
Standard: F77 F90 F95 F2003 F2008
  Example Program
<Syntax>
SHIFTA ( I, SHIFT )

I : Integer;
SHIFT : Integer, conformable with I;

Result : Same type and kind as I.
<Semantics>
The value of the result is obtained by shifting I to the right SHIFT times, but the leftmost bit (the “sign bit”) is replicated instead of becoming zero. It is required that 0≤SHIFT≤BIT_SIZE(I). This is an elemental function; if any argument is an array the result is an array of the same shape, with the SHIFTA operation being applied elementwise.

The “A” in the name of the function is intended to mean “arithmetic”; however, SHIFTA on a negative number is only the same as division by a power of two if there are no one bits shifted out, otherwise it is rounded differently. For example, SHIFTA(-3,1) is -2, whereas -3/2 is -1.

<Related>
IAND intrinsic function, IEOR intrinsic function, IOR intrinsic function, ISHFT intrinsic function, ISHFTC intrinsic function, LEADZ intrinsic function, MASKL intrinsic function, MASKR intrinsic function, NOT intrinsic function, POPCNT intrinsic function, POPPAR intrinsic function, SHIFTL intrinsic function, SHIFTR intrinsic function, TRAILZ intrinsic function