Hacker News new | ask | show | jobs
by smsm42 4587 days ago
That's what I immediately wondered - why it's int and not size_t? Well, I guess in Java engine there could be technical reasons why it is int, but in general case of implementation you'd probably assume it's size_t and then only one of the fixes works.
1 comments

Yes, best fix:

   int mid = low + (high - low) / 2;