MCPcopy Create free account
hub / github.com/RenderKit/embree / LowerBound

Function LowerBound

tutorials/common/imgui/imgui.cpp:2228–2248  ·  view source on GitHub ↗

std::lower_bound but without the bullshit

Source from the content-addressed store, hash-verified

2226
2227// std::lower_bound but without the bullshit
2228static ImGuiStorage::ImGuiStoragePair* LowerBound(ImVector<ImGuiStorage::ImGuiStoragePair>& data, ImGuiID key)
2229{
2230 ImGuiStorage::ImGuiStoragePair* first = data.Data;
2231 ImGuiStorage::ImGuiStoragePair* last = data.Data + data.Size;
2232 size_t count = (size_t)(last - first);
2233 while (count > 0)
2234 {
2235 size_t count2 = count >> 1;
2236 ImGuiStorage::ImGuiStoragePair* mid = first + count2;
2237 if (mid->key < key)
2238 {
2239 first = ++mid;
2240 count -= count2 + 1;
2241 }
2242 else
2243 {
2244 count = count2;
2245 }
2246 }
2247 return first;
2248}
2249
2250// For quicker full rebuild of a storage (instead of an incremental one), you may add all your contents and then sort once.
2251void ImGuiStorage::BuildSortByKey()

Callers 9

GetIntMethod · 0.85
GetFloatMethod · 0.85
GetVoidPtrMethod · 0.85
GetIntRefMethod · 0.85
GetFloatRefMethod · 0.85
GetVoidPtrRefMethod · 0.85
SetIntMethod · 0.85
SetFloatMethod · 0.85
SetVoidPtrMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected