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?
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.
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:
when you write:
4 >> 1;
the result is:
because it shift 1 bit to the right, thus the binary expression is:
Thank you. Now I understand it.
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.