Possible Duplicate:
What does the “>>” operator in C# do?
Also related: Doubling a number - shift left vs. multiplication
This is code in C#.
I just need to know if I'm right.
I'm not sure with using operator >>
.
this code:
winHalfWidth = this.ClientSize.Width >> 1; // both is int
make the same as:
winHalfWidth = this.ClientSize.Width / 2;
and if I'm right so, this code should do:
quaterWidht = this.ClientSize.Width >> 2;
should do same as:
quaterWidth = this.ClientSize.Width / 4;
So 2 questions:
- Is it right?
- Is any difference between using
>>
and/
?- When we speak about int values?
- When we speak abou float values? (I thing there could be.. but I'am not sure.)
Answers like yes/no would be nice :)
Thanks.