VI_shrVBI_shrVSI_shrVLI_shrVQI_shr 
VU_shrVUB_shrVUS_shrVUL_shrVUQ_shrVUI_shr
Function"Shift to the right", i.e., divide by integer powers of 2.
Syntax C/C++#include <VImath.h>
void VI_shr( iVector Y, iVector X, ui size,unsigned C );
void VUL_shr( ulVector Y, ulVector X, ui size, unsigned C );

    (similarly all other functions of this family)
C++ VecObj#include <OptiVec.h>
void vector<T>::shr( const vector<T>& X, unsigned C );
Pascal/Delphiuses VImath;
procedure VI_shr( Y, X:iVector; size:UIntSize; C:UInt );
procedure VUL_shr( Y, X:ulVector; size:UIntSize; C:UInt );

    (similarly all other functions of this family)
CUDA function C/C++#include <cudaVImath.h>
int cudaVI_shr( iVector d_Y, iVector d_X, ui size, unsigned C );
int cudaVUL_shr( ulVector d_Y, ulVector d_X, ui size, unsigned C );
void VIcu_shr( iVector h_Y, iVector h_X, ui size, unsigned C );
void VULcu_shr( ulVector h_Y, ulVector h_X, ui size, unsigned C );
CUDA function Pascal/Delphiuses VImath;
function cudaVI_shr( d_Y, d_X:iVector; size:UIntSize; C:UInt ): IntBool;
function cudaVUL_shr( d_Y, d_X:ulVector; size:UIntSize; C:UInt ): IntBool;

procedure VIcu_shr( h_Y, h_X:iVector; size:UIntSize; C:UInt );
procedure VULcu_shr( h_Y, h_X:ulVector; size:UIntSize; C:UInt );
DescriptionYi = Xi >> C
All bits of Xi are shifted to the right by as many positions as indicated in the parameter C. This corresponds to an integer division by 2C. The sign of Yi is always the same as of Xi. In contrast to explicit integer divisions, the result is always rounded toward minus infinity: −15 / 2 = -7, but −15 >> 1 = -8.
Note that by shifting 8-bit numbers by more than 7 positions, any unsigned or positive number yields 0, whereas any negative number yields −1 in this case.
The same is true for 16-bit numbers upon shifting by more than 15 positions, and for 32-bit numbers being shifted by more than 31 positions.

C is always of the data type unsigned. Shifting by negative numbers C is, therefore, not possible. To perform a left-shift, the appropriate function of the VI_shl family has to be used.

Error handlingnone
Return valuenone
See alsoVI_divC,   VI_shl

VectorLib Table of Contents  OptiVec home