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 utils::binary_search(const double needle, const int n, const double *haystack)
{ {
int lo = 0; int lo = 0;
int hi = n-1; int hi = n - 1;
if (needle < haystack[lo]) return lo; if (needle < haystack[lo]) return lo;
if (needle >= haystack[hi]) return hi; 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 // insure haystack[lo] <= needle < haystack[hi] at every iteration
// done when lo,hi are adjacent // done when lo,hi are adjacent
int index = (lo+hi)/2; int index = (lo + hi) / 2;
while (lo < hi-1) { while (lo < hi - 1) {
if (needle < haystack[index]) hi = index; if (needle < haystack[index])
else if (needle >= haystack[index]) lo = index; hi = index;
index = (lo+hi)/2; else if (needle >= haystack[index])
lo = index;
index = (lo + hi) / 2;
} }
return index; return index;