From 8213cb9f48fc23c46f5ee83c16a1fd70fad68dd3 Mon Sep 17 00:00:00 2001 From: Allanis <allanis@saracraft.net> Date: Thu, 4 Jul 2013 13:43:24 +0100 Subject: [PATCH] [Change] Switched l+(h-l)/2 to (h+l) >> 1 in binary search. --- src/pilot.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pilot.c b/src/pilot.c index 78e3e85..fcbe603 100644 --- a/src/pilot.c +++ b/src/pilot.c @@ -68,7 +68,7 @@ unsigned int pilot_getNext(const unsigned int id) { l = 0; h = pilot_nstack-1; while(l <= h) { - m = l+(h-l)/2; /* For impossible overflow returning negative value. */ + m = (l+h) >> 1; /* For impossible overflow returning negative value. */ if(pilot_stack[m]->id > id) h = m-1; else if(pilot_stack[m]->id < id) l = m+1; else break;