MCPcopy Create free account
hub / github.com/PlotJuggler/PlotJuggler / contentHashKey

Function contentHashKey

pj_scene3D/widgets/src/mesh_loader.cpp:56–65  ·  view source on GitHub ↗

FNV-1a over a byte span — a cheap, stable content hash for embedded-texture cache keys (dedups identical embedded images and survives GL-context recreation).

Source from the content-addressed store, hash-verified

54// FNV-1a over a byte span — a cheap, stable content hash for embedded-texture
55// cache keys (dedups identical embedded images and survives GL-context recreation).
56std::string contentHashKey(const std::uint8_t* data, std::size_t size) {
57 std::uint64_t h = 1469598103934665603ULL; // FNV offset basis
58 for (std::size_t i = 0; i < size; ++i) {
59 h ^= data[i];
60 h *= 1099511628211ULL; // FNV prime
61 }
62 std::array<char, 17> buf{};
63 std::snprintf(buf.data(), buf.size(), "%016llx", static_cast<unsigned long long>(h));
64 return std::string("emb:") + buf.data();
65}
66
67// Resolve one texture map of a material into a TextureSource. Embedded glTF/GLB
68// images (assimp ref "*N") become inline bytes keyed by content hash; external

Callers 1

resolveTextureFunction · 0.85

Calls 2

dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected