Bitwise Operations -- Arithmetic Operations..
- by RBA
Hi,
Can you please explain the below lines, with some good examples.
A left arithmetic shift by n is
equivalent to multiplying by 2n
(provided the value does not
overflow),
while
a right arithmetic
shift by n of a two's complement value
is equivalent to dividing by 2n(2 to the power n) and
rounding toward negative infinity. If
the binary number is treated as ones'
complement, then the same right-shift
operation results in division by 2n
and rounding toward zero.
Thankx..