text
stringlengths 0
2.2M
|
---|
*A ^= a;
|
*B ^= b;
|
# else
|
// multiply
|
*A = _umul128(*A, *B, B);
|
# endif
|
#else
|
const uint64_t ha = *A >> 32, hb = *B >> 32;
|
const uint64_t la = (uint32_t) *A, lb = (uint32_t) *B;
|
const uint64_t rh = ha * hb, rl = la * lb;
|
const uint64_t rm0 = ha * lb, rm1 = hb * la;
|
const uint64_t t = rl + (rm0 << 32);
|
const uint64_t lo = t + (rm1 << 32);
|
const uint64_t hi = rh + (rm0 >> 32) + (rm1 >> 32) + (t < rl) + (lo < t);
|
# if U_WYMUM_XOR
|
// multiply -> xor
|
*A ^= lo;
|
*B ^= hi;
|
# else
|
// multiply
|
*A = lo;
|
*B = hi;
|
# endif
|
#endif
|
}
|
//multiply and xor mix function, aka MUM
|
static inline
|
uint64_t _wymix(uint64_t A, uint64_t B)
|
{
|
_wymum(&A,&B);
|
return A^B;
|
}
|
//read functions
|
#if defined(BSLS_PLATFORM_IS_LITTLE_ENDIAN)
|
static inline
|
uint64_t _wyr8(const uint8_t *p)
|
{
|
uint64_t v;
|
memcpy(&v, p, 8);
|
return v;
|
}
|
static inline
|
uint64_t _wyr4(const uint8_t *p)
|
{
|
uint32_t v;
|
memcpy(&v, p, 4);
|
return v;
|
}
|
#else
|
static inline
|
uint64_t _wyr8(const uint8_t *p)
|
{
|
bsls::Types::Uint64 v;
|
memcpy(&v, p, 8);
|
return bsls::ByteOrderUtil::swapBytes64(v);
|
}
|
static inline
|
uint64_t _wyr4(const uint8_t *p)
|
{
|
unsigned v;
|
memcpy(&v, p, 4);
|
return bsls::ByteOrderUtil::swapBytes32(v);
|
}
|
#endif
|
static inline
|
uint64_t _wyr3(const uint8_t *p, size_t k)
|
// Read a mix of the 'k' bytes beginning at 'p', where 'k' is in the range
|
// '[ 1 .. 3 ]'.
|
{
|
BSLS_ASSERT_SAFE(1 <= k && k <= 3);
|
return (((uint64_t) p[0]) << 16) | (((uint64_t) p[k >> 1]) << 8) |
|
p[k - 1];
|
}
|
//wyhash main function
|
static inline
|
uint64_t wyhash(const uint8_t *p,
|
size_t len,
|
uint64_t seed)
|
{
|
// These values were copied directly from the original source.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.