Mikroelektronika MIKROE-742 데이터 시트

다운로드
페이지 532
Bitwise Shift Operators
Binary operators 
shl
and 
shr
move the bits of the left operand by a number of posi-
tions specified by the right operand, to the left or right, respectively. Right operand
has to be positive and less than 255.
With shift left (
shl
), left most bits are discarded, and “new” bits on the right are
assigned zeroes. Thus, shifting unsigned operand to the left by 
n
positions is equiv-
alent to multiplying it by 2n if all discarded bits are zero. This is also true for signed
operands if all discarded bits are equal to the sign bit.
With shift right (
shr
), right most bits are discarded, and the “freed” bits on the left
are assigned zeroes (in case of unsigned operand) or the value of the sign bit (in
case of signed operand). Shifting operand to the right by n positions is equivalent to
dividing it by 2n.
Boolean Operators
Although mikroPascal PRO for AVR does not support 
boolean
type, you have
Boolean operators at your disposal for building complex conditional expressions.
These operators conform to standard Boolean logic and return either 
TRUE
(all ones)
or
FALSE 
(zero):
Boolean operators associate from left to right. Negation operator not associates
from right to left.
160
MIKROELEKTRONIKA
- SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Language Reference
mikroPASCAL PRO for AVR
CHAPTER 5
Operator
Operation
and
logical AND
or
logical OR
xor
logical exclusive OR (XOR)
not
logical negation