Archive-SCS
view release on metacpan or search on metacpan
inc/city.cc view on Meta::CPAN
return uint64_in_expected_order(UNALIGNED_LOAD64(p));
}
static uint32 Fetch32(const char *p) {
return uint32_in_expected_order(UNALIGNED_LOAD32(p));
}
// Some primes between 2^63 and 2^64 for various uses.
static const uint64 k0 = 0xc3a5c85c97cb3127ULL;
static const uint64 k1 = 0xb492b66fbe98f273ULL;
static const uint64 k2 = 0x9ae16a3b2f90404fULL;
static const uint64 k3 = 0xc949d7c7509e6557ULL;
// Bitwise right rotate. Normally this will compile to a single
// instruction, especially if the shift is a manifest constant.
static uint64 Rotate(uint64 val, int shift) {
// Avoid shifting by 64: doing so yields an undefined result.
return shift == 0 ? val : ((val >> shift) | (val << (64 - shift)));
}
// Equivalent to Rotate(), but requires the second arg to be non-zero.
t/01-cityhash.t view on Meta::CPAN
use strict;
use warnings;
use lib 'lib';
use blib;
use Archive::SCS::CityHash qw(
cityhash64
);
use Test::More;
is unpack('H*', cityhash64 ''), '9ae16a3b2f90404f';
done_testing;
( run in 1.822 second using v1.01-cache-2.11-cpan-39bf76dae61 )