MCPcopy Create free account
hub / github.com/PCSX2/pcsx2 / VmaBinaryFindFirstNotLess

Function VmaBinaryFindFirstNotLess

3rdparty/vulkan/include/vk_mem_alloc.h:4125–4142  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4123*/
4124template <typename CmpLess, typename IterT, typename KeyT>
4125IterT 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
4144template<typename CmpLess, typename IterT, typename KeyT>
4145IterT VmaBinaryFindSorted(const IterT& beg, const IterT& end, const KeyT& value, const CmpLess& cmp)

Callers 2

VmaVectorInsertSortedFunction · 0.70
VmaVectorRemoveSortedFunction · 0.70

Calls 1

cmpFunction · 0.50

Tested by

no test coverage detected