MCPcopy Create free account
hub / github.com/KhronosGroup/KTX-Software / VmaBinaryFindFirstNotLess

Function VmaBinaryFindFirstNotLess

other_include/vma/vk_mem_alloc.h:3588–3604  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3586*/
3587template <typename CmpLess, typename IterT, typename KeyT>
3588static IterT VmaBinaryFindFirstNotLess(IterT beg, IterT end, const KeyT& key, const CmpLess& cmp)
3589{
3590 size_t down = 0, up = size_t(end - beg);
3591 while (down < up)
3592 {
3593 const size_t mid = down + (up - down) / 2; // Overflow-safe midpoint calculation
3594 if (cmp(*(beg + mid), key))
3595 {
3596 down = mid + 1;
3597 }
3598 else
3599 {
3600 up = mid;
3601 }
3602 }
3603 return beg + down;
3604}
3605
3606template<typename CmpLess, typename IterT, typename KeyT>
3607IterT VmaBinaryFindSorted(const IterT& beg, const IterT& end, const KeyT& value, const CmpLess& cmp)

Callers 6

VmaVectorInsertSortedFunction · 0.85
VmaVectorRemoveSortedFunction · 0.85
insertMethod · 0.85
findMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected