Skip to content
This repository has been archived by the owner on Dec 29, 2020. It is now read-only.

Commit

Permalink
Merge pull request #9 from ahoying/EfficientRecordProcessing
Browse files Browse the repository at this point in the history
Fix bug in find_in_int_array
  • Loading branch information
adepasquale committed Dec 14, 2015
2 parents 9341e68 + 57538bd commit 581f231
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions fw1-loggrabber.c
Original file line number Diff line number Diff line change
Expand Up @@ -5186,20 +5186,20 @@ find_in_int_array (int * a, int len, int val)
return FALSE;
}

while (right > left + 1)
while (right >= left)
{
int middle = (right+left) / 2;
if (a[middle] == val)
if (val == a[middle])
{
return TRUE;
}
else if (a[middle] > val)
else if (val > a[middle])
{
right = middle;
left = middle + 1;
}
else
{
left = middle;
right = middle - 1;
}
}

Expand Down

0 comments on commit 581f231

Please sign in to comment.