Shifts a bit pattern to the right.
Sar m, n
m:integer variable
n:iexp
Sar m, n shifts a bit pattern of an integer variable m n steps to the right (Sar = Shift Right), in which the highest bit is copied (and not replaced with zero like with Shr). Each bit shift right is a division by two.
The shift operation to be performed is determined from the data type of the variable.
Dim m% = 8, m8 As Large = 8
Sar m%, 2
Print m% // = 2
Sar m8, 2
Print m8 // = 2
See Sar() for a demonstration of how the bits are shifted.
{Created by Sjouke Hamstra; Last updated: 22/10/2014 by James Gaite}