APU_DECLARE(apr_uint64_t) apr_siphash48(const void *src, apr_size_t len, const unsigned char key[APR_SIPHASH_KSIZE]) { apr_uint64_t h; #undef cROUNDS #define cROUNDS \ SIPROUND(); \ SIPROUND(); \ SIPROUND(); \ SIPROUND(); #undef dROUNDS #define dROUNDS \ SIPROUND(); \ SIPROUND(); \ SIPROUND(); \ SIPROUND(); \ SIPROUND(); \ SIPROUND(); \ SIPROUND(); \ SIPROUND(); SIPHASH(h, src, len, key); return h; }
uint64_t Floating_hash (Floating* self) { if (CACHE(self)->hash) { return CACHE(self)->hash; } mpfr_exp_t exp; char* string = mpfr_get_str(NULL, &exp, 32, 0, *self->value, MPFR_RNDN); size_t size = strlen(string); CACHE(self)->hash = SIPHASH(RUNTIME_FOR(self), string, size + 1) ^ ((VALUE_TYPE_FLOATING << 4) ^ exp); return CACHE(self)->hash; }
APU_DECLARE(apr_uint64_t) apr_siphash(const void *src, apr_size_t len, const unsigned char key[APR_SIPHASH_KSIZE], unsigned int c, unsigned int d) { apr_uint64_t h; unsigned int i; #undef cROUNDS #define cROUNDS \ for (i = 0; i < c; ++i) { \ SIPROUND(); \ } #undef dROUNDS #define dROUNDS \ for (i = 0; i < d; ++i) { \ SIPROUND(); \ } SIPHASH(h, src, len, key); return h; }