
33
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:
It identifies the begin of a group of calculation or function a=(c+b)/(x+y)
Mathematical addition a=b+c
Mathematical subtraction a=b-c
Mathematical multiplication a=b*c
Mathematical division a=b/c
It identifies the end of a group of calculation or function a=(c+b)/(x+y)
Greater than condition if a>b
Less than condition if a<b
Greater or equal than condition if a>=b
Less or equal than condition if a<=b
Not equal condition if a<>b
Equal condition if a=b or assignment a=b
OR logic condition if (a=b) || (b=c)
condition it's true if at least one expression is true
AND logic condition if (a=b) && (b=c)
condition it's true if both expressions are true
Execute the OR between two value a=a|3
Bits 1 and 2 of variable a are set leaving unchanged the others
Execute the AND between two value a=a&3
All bit of variable a are reset except the bits 1 and 2
Negation of an expression if !(a<>b)
The expression is true if a is equal to b
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
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
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
Komentáře k této Příručce