MCPcopy Create free account
hub / github.com/KebsCS/KBotExt / next_chunk

Method next_chunk

KBotExt/imgui/imgui_internal.h:695–695  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

693 T* alloc_chunk(size_t sz) { size_t HDR_SZ = 4; sz = IM_MEMALIGN(HDR_SZ + sz, 4u); int off = Buf.Size; Buf.resize(off + (int)sz); ((int*)(void*)(Buf.Data + off))[0] = (int)sz; return (T*)(void*)(Buf.Data + off + (int)HDR_SZ); }
694 T* begin() { size_t HDR_SZ = 4; if (!Buf.Data) return NULL; return (T*)(void*)(Buf.Data + HDR_SZ); }
695 T* next_chunk(T* p) { size_t HDR_SZ = 4; IM_ASSERT(p >= begin() && p < end()); p = (T*)(void*)((char*)(void*)p + chunk_size(p)); if (p == (T*)(void*)((char*)end() + HDR_SZ)) return (T*)0; IM_ASSERT(p < end()); return p; }
696 int chunk_size(const T* p) { return ((const int*)p)[-1]; }
697 T* end() { return (T*)(void*)(Buf.Data + Buf.Size); }
698 int offset_from_ptr(const T* p) { IM_ASSERT(p >= begin() && p < end()); const ptrdiff_t off = (const char*)p - Buf.Data; return (int)off; }

Calls 2

beginFunction · 0.70
endFunction · 0.70

Tested by

no test coverage detected