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

  cityhash64_hex
  cityhash64_int
  cityhash64_as_hex
  cityhash64_as_int
);

# No need to worry about 32-bit systems, this dist doesn't build on those anyway
no warnings 'portable';

# Known hash value for the empty string
my $empty_hex = q'9ae16a3b2f90404f';
my $empty_int = 0x9ae16a3b2f90404f;

# The internal hash format is the hex string
my $empty = $empty_hex;

# Produce the internal format
is cityhash64     '',         $empty, 'cityhash64';
is cityhash64_hex $empty_hex, $empty, 'cityhash64_hex';
is cityhash64_int $empty_int, $empty, 'cityhash64_int';

# Convert internal format to usable output



( run in 1.323 second using v1.01-cache-2.11-cpan-788537b7465 )