I’m reading through the underscore.js code. I found this:
var mid = (low + high) >> 1;
What does >> 1 do? Why is it useful?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It shifts the bits in the left side to the right by one bit. It is equivalent to dividing by 2.
In ‘Ye olden times’ this was faster than simply dividing, though I doubt it would make a whole lot of difference in underscore’s case.