Allows you to modify a binary number by shifting all its bits to the right by a specified amount.
BitwiseShiftRight ( val, shift_amount)
Argument |
Description |
---|---|
val |
Unsigned long for the binary number you want to modify |
shift_amount |
Unsigned integer for the number of places you want to shift the bits of a binary number |
UnsignedLong. Returns the result for a binary number when its bits are shifted to the right by the amount specified in the shift_amount argument. If one of its arguments is null, BitwiseShiftRight returns null.
In PocketBuiilder there are 32 bits in an unsigned long. If you enter 31 or greater for shift_amount, PocketBuilder fires the runtime SystemError event because the value is out of range.
This example shifts the bits in testValue three places to the right:
UnsignedLong ll_result
ll_result = BitwiseShiftRight(testValue, 2)
In this example, when testValue is 10, its binary equivalent has bits in the second and fourth positions. If you shift the bits two places to the right, the resulting number is 2, with a bit set in the second position only. The other bit was moved out of range.