Closed chm-diederichs closed 2 years ago
I think this would be sufficient also:
#define SN_COPY_32(a, b) \
{ \
long long *src = (long long *) a; \
long long *dst = (long long *) b; \
*dst = *src; \
*(++dst) = *(++src); \
*(++dst) = *(++src); \
*(++dst) = *(++src); \
};
cc @kasperisager for review of that
https://en.wikipedia.org/wiki/C_data_types <-- guaranteed to be 64bit
I'd use uint64_t
from stdint.h
to make the intent clear.
Wouldn't stdint.h
reintroduce stdlib dep?
I've used the above macro, but using explicit indices instead of incrementing the pointer for clarity. Let me know if I should revert to the macro above.
@chm-diederichs stdint.h
only contains typedefs so no symbols should be linked against.
Granted, long long
works fine and is guaranteed to be at least 64 bits!
Release? 🙏
Any update on this?
This PR removes the
string.h
dependency.Previously
memcpy
was used to write from intermediate values to the returned value. In both cases only 32 bytes were copied, so a naive for loop is used instead.