SHR (shift right)

Right shifts the bits of a value.

Syntax

SHR1 value [in,1], n [in,1u], result [out,1] ;code:117
SHR2 value [in,2], n [in,1u], result [out,2] ;code:118
SHR4 value [in,4], n [in,1u], result [out,4] ;code:119
SHR8 value [in,8], n [in,1u], result [out,8] ;code:120

Description

This instruction performs bitwise right shift operation by n bits: result = value >> n.

This instruction shifts the bits of input value right by the number of bits specified in n. Digits shifted off the right are discarded. New bits on the left are 0.

If n is greater than number of bits in the value (correspondingly 8, 16, 32 or 64) the result is undefined.

NoASM

There are several kinds of these instructions defined in NoASM Compiler:

SHR1,  SHR2,  SHR4,  SHR8,
SHR1u, SHR2u, SHR4u, SHR8u