17.4 Operator

The operator is a key element of the operation expressions. The system starts calculating from the operator with higher priority. If the priorities are same, the operators are calculated from left to right. Be aware of that the substitution operator “=” is calculated from right to left.

In case of the string calculation, the both sides must be composed of strings. You can use the operators such as =, +, <, >, ,+, >=, ==, != for the string calculation.

The result of the internal operations (except the string) is processed as 8 Byte Double.

Operator

Function

Example

Description

=

Substitution Operator

TAG_A = 3 + 4

Substitutes the result of ‘3+4’ (=7) to the TAG_A.

~

One’s Complement

~TAG_A

When the TAG_A’s value is 00110101b, the result is 11001010b.

!

Logical NOT

!TAG_A

If the TAG_A is 0, the result is 1. If the value is not 0, the result is 0.

+

Addition

TAG_A+4

"ABC" + "123"

Represents the result of adding the TAG_A and 4. In case of the sum of two strings, it indicates the "ABC123".

-

Subtraction

TAG_A – 4

Represents the result of subtracting 4 from the TAG_A.

*

Multiplication

TAG_A * 7

Represents the result of multiplying TAG_A and 7.

/

Division

TAG_A / 7

Represents the result of dividing TAG_A by 7.

%

Remainder

TAG_A % 7

Represents the remainder of the TAG_A divided by 7.

&

Bitwise AND

TAG_A & 0101b

If the TAG_A is 0011b, the result is 0001b.

|

Bitwise OR

TAG_A | 0101b

If the TAG_A is 0011b, the result is 0111b.

^

Bitwise XOR

TAG_A ^ 0101b

If the TAG_A is 0011b, the result is 0110b.

&&

Logical AND

Formula1 && Formula2

If both Formula 1 and 2 are true, the result is 1. In other cases, the result is 0.

||

Logical OR

Formula1 || Formula2

If both Formula 1 and 2 are false, the result is 0. In other cases, the result is 1.

<< 

Shift to Left

TAG_A << 3

Represents the bits of TAG_A which are shifted 3 bits to the left side. The right side of the bits are filled with 0.

If TAG_A is 00110101b, the result is 10101000b.

>> 

Shift to Right

TAG_A >> 3

Represents the bits of TAG_A which are shifted 3 bits to the right side. The left side of the bits are filled with 0.

If TAG_A is 00110101b, the result is 0000110b.

Less than

TAG_A < 7

If the TAG_A is less than 7, the result is 1. If not, the result is 0.

Greater than

TAG_A > 7

If the TAG_A is greater than 7, the result is 1. If not, the result is 0.

<=

Less than or Equal to

TAG_A <= 7

If the TAG_A is less than or equal to 7, the result is 1. If not, the result is 0.

>=

Greater than or Equal to

TAG_A >= 7

If the TAG_A is greater than or equal to 7, the result is 1. If not, the result is 0.

==

Equal to

TAG_A == 7

If the TAG_A is 7, the result is 1. If not, the result is 0.

!=

Not Equal to

TAG_A != 7

If the TAG_A is not 7, the result is 1. If not, the result is 0.