binary search
Fix MAX_UINT/2 overflow bug. Thanks mcpherrin!