Archived

This topic is now archived and is closed to further replies.

Liquidus

what does (3>>4) do?

Recommended Posts

i had never seen anything like this when programmming for the PC. But now that i have started programming on the dreamcast and playstation2 it comes up alot. It seems that maybe it converts numbers to hex or something like that. Can someone give me the exact definition of what the >> symbol between numbers does? Thanks

Share this post


Link to post
Share on other sites
>> is the right bitwise shift operator. It takes the number to the left of it and shifts each bit in the binary representation of said number over the number on the right of it times (ie, x >> y shifts x right y times). Shifting right in the binary system is equivalent to dividing by two, just as shifting right in decimal is equivalent to dividing by ten, so it''s a quick way to do binary division and exponentiation (shift left).

Share this post


Link to post
Share on other sites