| 4123 | */ |
| 4124 | template <typename CmpLess, typename IterT, typename KeyT> |
| 4125 | IterT VmaBinaryFindFirstNotLess(IterT beg, IterT end, const KeyT& key, const CmpLess& cmp) |
| 4126 | { |
| 4127 | size_t down = 0; |
| 4128 | size_t up = size_t(end - beg); |
| 4129 | while (down < up) |
| 4130 | { |
| 4131 | const size_t mid = down + (up - down) / 2; // Overflow-safe midpoint calculation |
| 4132 | if (cmp(*(beg + mid), key)) |
| 4133 | { |
| 4134 | down = mid + 1; |
| 4135 | } |
| 4136 | else |
| 4137 | { |
| 4138 | up = mid; |
| 4139 | } |
| 4140 | } |
| 4141 | return beg + down; |
| 4142 | } |
| 4143 | |
| 4144 | template<typename CmpLess, typename IterT, typename KeyT> |
| 4145 | IterT VmaBinaryFindSorted(const IterT& beg, const IterT& end, const KeyT& value, const CmpLess& cmp) |
no test coverage detected