apply clang-format

This commit is contained in:
Axel Kohlmeyer
2021-09-06 17:01:22 -04:00
parent 898f8086db
commit 63a2882127

View File

@ -1288,7 +1288,7 @@ int utils::date2num(const std::string &date)
int utils::binary_search(const double needle, const int n, const double *haystack)
{
int lo = 0;
int hi = n-1;
int hi = n - 1;
if (needle < haystack[lo]) return lo;
if (needle >= haystack[hi]) return hi;
@ -1296,11 +1296,13 @@ int utils::binary_search(const double needle, const int n, const double *haystac
// insure haystack[lo] <= needle < haystack[hi] at every iteration
// done when lo,hi are adjacent
int index = (lo+hi)/2;
while (lo < hi-1) {
if (needle < haystack[index]) hi = index;
else if (needle >= haystack[index]) lo = index;
index = (lo+hi)/2;
int index = (lo + hi) / 2;
while (lo < hi - 1) {
if (needle < haystack[index])
hi = index;
else if (needle >= haystack[index])
lo = index;
index = (lo + hi) / 2;
}
return index;