1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
|
#include "SpookyV2.h"
#ifdef __cplusplus
extern "C" {
#endif
void SpookyHash32_with_state_test(const void *key, size_t len, const void *state, void *out) {
uint64 *state64= (uint64 *)state;
uint64 s0 = state64[0];
uint64 s1 = state64[1];
SpookyHash::Hash128(key, len, &s0, &s1);
((uint32 *)out)[0]= (uint32)s0;
}
void SpookyHash64_with_state_test(const void *key, size_t len, const void *state, void *out) {
uint64 *state64= (uint64 *)state;
uint64 *out64= (uint64 *)out;
out64[0] = state64[0];
uint64 s1 = state64[1];
SpookyHash::Hash128(key, len, out64, &s1);
}
void SpookyHash128_with_state_test(const void *key, size_t len, const void *state, void *out) {
uint64 *state64= (uint64 *)state;
uint64 *out64= (uint64 *)out;
out64[0] = state64[0];
out64[1] = state64[1];
SpookyHash::Hash128(key, len, out64, out64+1);
}
void SpookyHash_seed_state_test(int in_bits, const void *seed, void *state) {
uint64 *state64= (uint64 *)state;
if (in_bits == 32) {
state64[0]= state64[1]= ((uint32*)seed)[0];
}
else {
uint64 *seed64= (uint64 *)seed;
if (in_bits == 64) {
state64[0]= state64[1]= seed64[0];
}
else
if (in_bits == 128) {
state64[0]= seed64[0];
state64[1]= seed64[1];
}
}
}
#ifdef __cplusplus
}
#endif
|