Stateflow | ![]() ![]() |
Binary and Bitwise Operations
The table that follows summarizes the interpretation of all binary operators in Stateflow action language. Table order gives relative operator precedence; highest precedence (10) is at the top of the table. Binary operators are evaluated left to right (left associative).
If you select the Enable C-like bit operations check box in the properties dialog for the chart (see the section Specifying Chart Properties), some of the binary operators are interpreted as bitwise operators. See individual operators in the table that follows for specific binary or bit operator interpretations.
Example |
Precedence |
Description |
a * b |
10 |
Multiplication |
a / b |
10 |
Division |
a %% b |
10 |
Modulus |
a + b |
9 |
Addition |
a - b |
9 |
Subtraction |
a >> b |
8 |
Shift operand a right by b bits. Noninteger operands for this operator are first cast to integers before the bits are shifted. |
a << b |
8 |
Shift operand a left by b bits. Noninteger operands for this operator are first cast to integers before the bits are shifted. |
a > b |
7 |
Comparison of the first operand greater than the second operand |
a < b |
7 |
Comparison of the first operand less than the second operand |
a >= b |
7 |
Comparison of the first operand greater than or equal to the second operand |
a <= b |
7 |
Comparison of the first operand less than or equal to the second operand |
a == b |
6 |
Comparison of equality of two operands |
a ~= b |
6 |
Comparison of inequality of two operands |
a != b |
6 |
Comparison of inequality of two operands |
a <> b |
6 |
Comparison of inequality of two operands |
a & b |
5 |
One of the following:
|
a ^ b |
4 |
One of the following:
|
a | b |
3 |
One of the following:
|
a && b |
2 |
Logical AND of two operands |
a || b |
1 |
Logical OR of two operands |
![]() | Operations | Unary Operations | ![]() |