MCPcopy Create free account
hub / github.com/Luce-Org/lucebox-hub / read_counted_i32

Function read_counted_i32

server/src/common/daemon_loop.cpp:158–171  ·  view source on GitHub ↗

Read a prompt file with uint32 length prefix + N int32 token IDs.

Source from the content-addressed store, hash-verified

156 std::ifstream f(path, std::ios::binary | std::ios::ate);
157 if (!f) return {};
158 const auto sz = (size_t)f.tellg();
159 f.seekg(0);
160 std::vector<int32_t> ids(sz / sizeof(int32_t));
161 if (!ids.empty()) {
162 f.read(reinterpret_cast<char *>(ids.data()),
163 (std::streamsize)ids.size() * sizeof(int32_t));
164 if (!f) return {};
165 }
166 return ids;
167}
168
169// Read a prompt file with uint32 length prefix + N int32 token IDs.
170static std::vector<int32_t> read_counted_i32(const std::string & path) {
171 std::ifstream f(path, std::ios::binary);
172 if (!f) return {};
173 uint32_t n = 0;
174 f.read(reinterpret_cast<char *>(&n), sizeof(n));

Callers 1

run_daemonFunction · 0.70

Calls 2

dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected