xxHash
xxHash copied to clipboard
A memcpy fused version would be nice.
As per the title: for performance reasons (single pass & overlapping writes) a version which performs xxh3 and memcpy would be nice to have. Ideally with the option for nt stores where available.
What do you mean ?
a "safer" memcpy()
followed by a memcmp()
?
I have no idea what is actually asked in this issue.
But I'm just guessing "fused" function means:
memcpy(dst, data, dataSize);
xxh_update(&state, dst, dataSize);
More specific example:
uint8_t* p = ...;
xxh_state state = ...;
while(...) {
// Store some data to tmp[]
uint8_t tmp[...];
my_magic_func(tmp, sizeof(tmp), ...);
// LHS ("performance reason") may happen
// - https://en.wikipedia.org/wiki/Load-Hit-Store
// We can reverse the order of invocation in this case though.
memcpy(p, tmp, sizeof(tmp));
xxh_update(&state, p, sizeof(tmp));
p += sizeof(tmp);
}
hash = xxh_digest(&state);