MCPcopy Create free account
hub / github.com/alibaba/zvec / ValidContiguousView

Function ValidContiguousView

src/core/interface/vector_source.cc:26–35  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24namespace {
25
26bool ValidContiguousView(const ContiguousBatch &view) {
27 if (!view.count) return true;
28 constexpr auto kInvalidId = std::numeric_limits<uint32_t>::max();
29 if (!view.data || !view.stride || view.first_id >= kInvalidId ||
30 view.count > kInvalidId - view.first_id)
31 return false;
32 const auto max_span = std::numeric_limits<uintptr_t>::max() -
33 reinterpret_cast<uintptr_t>(view.data);
34 return view.count <= max_span / view.stride;
35}
36
37const void *GetContiguousVector(const ContiguousBatch &view, uint32_t id) {
38 if (id < view.first_id || id - view.first_id >= view.count) return nullptr;

Callers 3

get_vectorMethod · 0.85
get_vectorsMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected