User guide
33
VTB USER GUIDE
7 OPERATORS
The operators of VTB are common to other compilers.
7.1 Logic and Mathematical Operators
These are all the logic and mathematical operators available in VTB:
OPERATOR
DESCRIPTION
EXAMPLE
(
Parenthesis
It identifies the begin of a group of calculation or function a=(c+b)/(x+y)
fun(10,20)
+
Addition
Mathematical addition a=b+c
-
Subtraction
Mathematical subtraction a=b-c
*
Multiplication
Mathematical multiplication a=b*c
/
Division
Mathematical division a=b/c
)
Parenthesis
It identifies the end of a group of calculation or function a=(c+b)/(x+y)
fun(10,20)
>
Greater
Greater than condition if a>b
<
Less
Less than condition if a<b
>=
Greater Equal
Greater or equal than condition if a>=b
<=
Less Equal
Less or equal than condition if a<=b
<>
Not equal
Not equal condition if a<>b
=
Equal
Equal condition if a=b or assignment a=b
||
Logic OR
OR logic condition if (a=b) || (b=c)
condition it's true if at least one expression is true
&&
Logic AND
AND logic condition if (a=b) && (b=c)
condition it's true if both expressions are true
|
OR bit
Execute the OR between two value a=a|3
Bits 1 and 2 of variable a are set leaving unchanged the others
&
AND bit
Execute the AND between two value a=a&3
All bit of variable a are reset except the bits 1 and 2
!
Logic NOT
Negation of an expression if !(a<>b)
The expression is true if a is equal to b
~
NOT bit
Execute a not on all the bits of a value, all bits will change its state
a=85 a=~a
After NOT instruction the variable a will take the value 170
85 → 01010101
170 → 10101010
>>
Shift to right
The bits of the variable are shifted to left n times
a=8 a=a>>3 After shift the variable a will take the value 1
<<
Shift to left
The bits of the variable are shifted to right n times
a=1 a=a<<3 After shift the variable a will take the value 8










