RShift64 Function
Shifts numeric data to the right by a user specified number of bits.
Syntax
RShift64(number, shiftBits)
Parameters
- number
- Specify the numeric value to be logically shifted, either as an expression or directly as a numeric value.
- shiftBits
- Specifies the bit numeric value (integer value from 0 to 63) to be right-logically shifted.
Return Values
Returns a numeric result which is equal to the value of number after shifting right shiftbits number of bits.
Description
RShift64 shifts the specified numeric data (number) to the right (toward a lower order digit) by the specified number of bits (shiftBits). The high order bits shifted are replaced by 0.
The simplest explanation for RShift64 is that it simply returns the result of number / 2shiftBits. (Number is divided by 2 shiftBit times.)
Note
Numeric Data Type:
The numeric data (number) may be any valid numeric data type. RShift64 works with Int64 and UInt64 data types.
See Also
And, LShift, LShift64, Not, Or, RShift, Xor
RShift64 Function Example
The example shown below shows a program which shows all the possible RShift64 values for an Integer data type starting with the integer set to “0”.
Function rshif64tst
UInt64 num, snum, i
num = 18446744073709551615
For i = 1 to 63
Print "i =", i
snum = RShift64(num, i)
Print "RShift64(18446744073709551615, ", i, ") = ", snum
Next i
Fend
Some other example results from the RShift64 instruction from the command window.
> Print RShift64(10,1)
5
> Print RShift64(8,3)
1
> Print RShift64(16,2)
4