
Appendix A. CRBasic Programming Instructions
497
>>
Bitwiserightshift
Syntax
Variable = Numeric Expression >> Amount
&
BitwiseANDassignment‐‐PerformsabitwiseANDofavariablewithan
expressionandassignstheresultbacktothevariable.
A.6.4 Compound-assignment operators
Table 120. Compound-Assignment Operators
Symbo
l
Name Function
^=
Exponent
assignment
Raises the value of a variable to the power of an expression and
assigns the result back to the variable.
*=
Multiplication
assignment
Multiplies the value of a variable by the value of an expression and
assigns the result to the variable.
+=
Addition
assignment
Adds the value of an expression to the value of a variable and
assigns the result to the variable. Also concatenates a String
expression to a String variable and assigns the result to the
variable.
-=
Subtraction
assignment
Subtracts the value of an expression from the value of a variable
and assigns the result to the variable.
/=
Division
assignment
Divides the value of a variable by the value of an expression and
assigns the result to the variable.
\=
Division integer
assignment
Divides the value of a variable by the value of an expression and
assigns the integer result to the variable.
CRBasicExample71. UsingBit‐ShiftOperators
Dim input_val As Long
Dim value_1 As Long
Dim value_2 As Long
Dim value_3 As Long
'read input_val somehow
value_1 = (input_val AND &B11000000) >> 6
value_2 = (input_val AND &B00110000) >> 4
'note that value_3 does not need to be shifted
value_3 = (input_val AND &B00001111)
A.6.5 Logical Operators
AND
Performsalogicalconjunctionontwoexpressions.
Syntax
result = expr1 AND expr2
Comentarios a estos manuales