Bitwise operators
There are six operators for manipulating bit-by-bit operations. The shift
operators >> and << perform the right and left shifts of the left operand by
the number of bit positions given by the right operand, which must be
positive. The unary ~ yields the one’s complement of an integer, converts
every 1-bit to a 0-bit and vice versa.
&
bitwise AND
|
bitwise OR
^
bitwise XOR
~
one’s complement
>>
right shift
<<
left shift
Assignment operators
There are a total of 10 assignment operators for expression statements. For
simple assignment, the equal sign is used with the value of the expression
replacing the variable, in the left operand. This also provides a shortcut for
modifying a variable by performing an operation on itself.
<var> + = <expr>
add the value of <expr> to <var>
<var> – = <expr>
subtract the value of <expr> from <var>
<var> * = <expr>
multiply <var> by the value of <expr>
<var> / = <expr>
divide <var> by the value of <expr>
<var> % = <expr>
modulus, remainder when <var> is divided by <expr>
<var> & = <expr>
bitwise AND <var> with the value of <expr>
<var> | = <expr>
bitwise OR <var> with the value of <expr>
<var>
∧
= <expr>
bitwise XOR <var> with the value of <expr>
<var> >> = <expr>
right shift <var> by <expr> positions
<var> << = <expr>
left shift <var> by <expr> positions
Increment and decrement operators
The increment and decrement operators can be used in a statement by
themselves, or can be embedded within a statement with other operators.
The position of the operator indicates whether the increment or decrement
is to be performed before (prefix operators) or after (postfix operators) the
evaluation of the statement it is embedded within.
++ <var>
pre-increment
<var> ++ post-increment
– – <var>
pre-decrement
<var>– –
post-decrement
HT-IDE User’s Guide
92
Summary of Contents for HT-IDE
Page 11: ...P a r t I Integrated Development Environment Part I Integrated Development Environment 1 ...
Page 12: ...HT IDE User s Guide 2 ...
Page 20: ...Fig 1 6 Fig 1 7 HT IDE User s Guide 10 ...
Page 24: ...HT IDE User s Guide 14 ...
Page 70: ...HT IDE User s Guide 60 ...
Page 76: ...HT IDE User s Guide 66 ...
Page 92: ...HT IDE User s Guide 82 ...
Page 93: ...P a r t I I Development Language and Tools Part II Development Language and Tools 83 ...
Page 94: ...HT IDE User s Guide 84 ...
Page 148: ...HT IDE User s Guide 138 ...
Page 150: ...Fig 12 1 Fig 12 2 HT IDE User s Guide 140 ...
Page 154: ...HT IDE User s Guide 144 ...
Page 192: ...HT IDE User s Guide 182 ...
Page 194: ...HT IDE User s Guide 184 ...
Page 218: ...HT IDE User s Guide 208 ...
Page 235: ...P a r t V Appendix Part V Appendix 225 ...
Page 236: ...HT IDE User s Guide 226 ...
Page 250: ...HT IDE User s Guide 240 ...