diff options
author | Mitya Selivanov <0x7fffff@guattari.ru> | 2022-08-07 08:37:53 +0400 |
---|---|---|
committer | Mitya Selivanov <0x7fffff@guattari.ru> | 2022-08-07 08:37:53 +0400 |
commit | 4429ed09b548518dbffce7ec77ddf5a8b09484b2 (patch) | |
tree | d3541ddc0077517c861fd0ed22a21a83618754b5 /source | |
parent | fd458396b376d0f9fff3dd5a03b1ef95c8cf870e (diff) | |
download | kit-4429ed09b548518dbffce7ec77ddf5a8b09484b2.zip |
Refactor
Diffstat (limited to 'source')
-rw-r--r-- | source/kit/lower_bound.h | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/source/kit/lower_bound.h b/source/kit/lower_bound.h index 5b04557..fee1648 100644 --- a/source/kit/lower_bound.h +++ b/source/kit/lower_bound.h @@ -5,34 +5,34 @@ extern "C" { #endif -#define KIT_LOWER_BOUND(return_val, array, value, op) \ - { \ - ptrdiff_t position_ = 0; \ - ptrdiff_t count_ = (array).size; \ - while (count_ > 0) { \ - ptrdiff_t delta_ = count_ / 2; \ - if (op((array).values[position_ + delta_], (value))) { \ - position_ += delta_ + 1; \ - count_ -= delta_ + 1; \ - } else \ - count_ = delta_; \ - } \ - (return_val) = position_; \ +#define KIT_LOWER_BOUND(return_val, array, value, op) \ + { \ + ptrdiff_t position_ = 0; \ + ptrdiff_t count_ = (array).size; \ + while (count_ > 0) { \ + ptrdiff_t delta_ = count_ / 2; \ + if ((op) ((array).values[position_ + delta_], (value))) { \ + position_ += delta_ + 1; \ + count_ -= delta_ + 1; \ + } else \ + count_ = delta_; \ + } \ + (return_val) = position_; \ } -#define KIT_LOWER_BOUND_REF(return_val, array, value, op) \ - { \ - ptrdiff_t position_ = 0; \ - ptrdiff_t count_ = (array).size; \ - while (count_ > 0) { \ - ptrdiff_t delta_ = count_ / 2; \ - if (op((array).values + position_ + delta_, &(value))) { \ - position_ += delta_ + 1; \ - count_ -= delta_ + 1; \ - } else \ - count_ = delta_; \ - } \ - (return_val) = position_; \ +#define KIT_LOWER_BOUND_REF(return_val, array, value, op) \ + { \ + ptrdiff_t position_ = 0; \ + ptrdiff_t count_ = (array).size; \ + while (count_ > 0) { \ + ptrdiff_t delta_ = count_ / 2; \ + if ((op) ((array).values + position_ + delta_, &(value))) { \ + position_ += delta_ + 1; \ + count_ -= delta_ + 1; \ + } else \ + count_ = delta_; \ + } \ + (return_val) = position_; \ } #ifdef __cplusplus |