Operator Shr= (Shift Right And Assign)
Shifts right and assigns a value to a variable
Declare Operator Shr= ( ByRef lhs As Integer, ByRef rhs As Integer )
Declare Operator Shr= ( ByRef lhs As UInteger, ByRef rhs As UInteger )
Declare Operator Shr= ( ByRef lhs As LongInt, ByRef rhs As LongInt )
Declare Operator Shr= ( ByRef lhs As ULongInt, ByRef rhs As ULongInt )
lhs shr= rhs
lhs
This operator shifts the bits in its left-hand side (lhs) parameter a number of times specified by its right-hand side (rhs) parameter, and assigns the result to lhs. It is functionally equivalent to:
This operator can be overloaded for user-defined types.
Syntax
Declare Operator Shr= ( ByRef lhs As Integer, ByRef rhs As Integer )
Declare Operator Shr= ( ByRef lhs As UInteger, ByRef rhs As UInteger )
Declare Operator Shr= ( ByRef lhs As LongInt, ByRef rhs As LongInt )
Declare Operator Shr= ( ByRef lhs As ULongInt, ByRef rhs As ULongInt )
Usage
lhs shr= rhs
Parameters
lhs
The variable to assign to.
rhsThe value to shift lhs right by.
Description
This operator shifts the bits in its left-hand side (lhs) parameter a number of times specified by its right-hand side (rhs) parameter, and assigns the result to lhs. It is functionally equivalent to:
lhs = lhs Shr rhs
This operator can be overloaded for user-defined types.
Example
Dim i As Integer
i = &b00011000 '' = 24
i Shr= 3 '' = i\2^3
'' Result: 11 3 3
Print Bin(i), i, 24\2^3
Sleep
i = &b00011000 '' = 24
i Shr= 3 '' = i\2^3
'' Result: 11 3 3
Print Bin(i), i, 24\2^3
Sleep
Dialect Differences
- Not available in the -lang qb dialect unless referenced with the alias __Shr=.
Differences from QB
- New to FreeBASIC
See also