An easy problem

Can someone explain me what does "(integer + integer) >> 1" mean ...
">>" in this case is a binary operation, it's moves 1 byte to the right. but is integer is a variable?

CMIIW
edited my post because I was lying -.-'
sorry for disinforming
Last edited on
What do you mean by "1 byte to the right"? and integer is not a varuable.
correction:
it's shouldn't "1 byte to the right" but "1 bit to the right. what i mean about this is:

binary expression for 4:

00000100

when you write:

4 >> 1;

the result is:

2

because it shift 1 bit to the right, thus the binary expression is:

00000010

CMIIW
Thank you. Now I understand it.
closed account (zb0S216C)
Note that shifting to the left is equivalent to multiplying by powers of two, and shifting to the right is equivalent to dividing by powers of 2.

Wazzak
Topic archived. No new replies allowed.