Digest-FarmHash

 view release on metacpan or  search on metacpan

ext/farmhash/farmhash.cc  view on Meta::CPAN

4273380883u,
2130315482u, 3429606032u, 3367732613u, 1912357694u,
422632590u, 1266957023u, 3437535648u, 736404240u,
2281709372u,
415859912u,
212948797u, 351612650u, 3920561440u, 112963586u,
2230727543u, 2851076612u, 1990662634u, 2264296857u,
3131463650u,
2704034623u,
3541637839u, 2954232792u, 533986918u, 4158757533u,
65174248u, 4232639593u, 865906667u, 1948225652u,
779656112u,
3873989249u,
2372984749u, 2346988193u, 1104345713u, 1165654138u,
4045762610u, 3588205178u, 461363991u, 1111215752u,
1389675192u,
2404325151u,
2152228101u, 3808973622u, 1901235912u, 3458690696u,
314513238u, 2539459143u, 2847998873u, 952026138u,
2325705328u,
407844712u,
3727960715u, 2996448351u, 2374336760u, 3138756390u,
2600015243u, 539980418u, 1876285352u, 1670330799u,
1709360377u,
2868531654u,
494777964u, 2773053597u, 599486162u, 3962209577u,
1871328846u, 2171933018u, 110279472u, 384074780u,
4147021936u,
2333589647u,
4251778066u, 40493468u, 3099342316u, 4108779767u,
2812424588u, 954542332u, 2040682331u, 2251152306u,
45915516u,
259525626u,
1045384743u, 4134656562u, 749389261u, 874399445u,
616549904u, 2200447504u, 436024539u, 78972290u,
3210485762u,
1907985531u,
3013721395u, 4214533685u, 4198804243u, 534879265u,
1517190881u, 3756787754u, 1152563554u, 1718750948u,
777737463u,
1402478860u,
1824562784u, 1879401449u, 3515818786u, 513165201u,
1423491227u, 2103067918u, 2291777410u, 1097943000u,
};

// Return false only if offset is -1 and a spot check of 3 hashes all yield 0.
bool Test(int offset, int len = 0) {
#undef Check
#undef IsAlive

#define Check(x) do {                                                   \
  const uint32_t actual = (x), e = expected[index++];                   \
  bool ok = actual == e;                                                \
  if (!ok) {                                                            \
    cerr << "expected " << hex << e << " but got " << actual << endl;   \
    ++errors;                                                           \
  }                                                                     \
  assert(ok);                                                           \
} while (0)

#define IsAlive(x) do { alive += IsNonZero(x); } while (0)

  // After the following line is where the uses of "Check" and such will go.
  static int index = 0;
if (offset == -1) { int alive = 0; IsAlive(farmhashcc::Hash32WithSeed(data, len++, SEED)); IsAlive(farmhashcc::Hash32(data, len++)); { uint128_t u = farmhashcc::Fingerprint128(data, len++); uint64_t h = Uint128Low64(u); IsAlive(h >> 32); IsAlive((h <...
Check(farmhashcc::Hash32WithSeed(data + offset, len, SEED));
Check(farmhashcc::Hash32(data + offset, len));
{ uint128_t u = farmhashcc::Fingerprint128(data + offset, len); uint64_t h = Uint128Low64(u); Check(h >> 32); Check((h << 32) >> 32); h = Uint128High64(u); Check(h >> 32); Check((h << 32) >> 32); }
{ uint128_t u = farmhashcc::CityHash128WithSeed(data + offset, len, Uint128(SEED0, SEED1)); uint64_t h = Uint128Low64(u); Check(h >> 32); Check((h << 32) >> 32); h = Uint128High64(u); Check(h >> 32); Check((h << 32) >> 32); }

  return true;
#undef Check
#undef IsAlive
}

int RunTest() {
  Setup();
  int i = 0;
  cout << "Running farmhashccTest";
  if (!Test(-1)) {
    cout << "... Unavailable\n";
    return NoteErrors();
  }
  // Good.  The function is attempting to hash, so run the full test.
  int errors_prior_to_test = errors;
  for ( ; i < kTestSize - 1; i++) {
    Test(i * i, i);
  }
  for ( ; i < kDataSize; i += i / 7) {
    Test(0, i);
  }
  Test(0, kDataSize);
  cout << (errors == errors_prior_to_test ? "... OK\n" : "... Failed\n");
  return NoteErrors();
}

#else

// After the following line is where the code to print hash codes will go.
void Dump(int offset, int len) {
cout << farmhashcc::Hash32WithSeed(data + offset, len, SEED) << "u," << endl;
cout << farmhashcc::Hash32(data + offset, len) << "u," << endl;
{ uint128_t u = farmhashcc::Fingerprint128(data + offset, len); uint64_t h = Uint128Low64(u); cout << (h >> 32) << "u, " << ((h << 32) >> 32) << "u, "; h = Uint128High64(u); cout << (h >> 32) << "u, " << ((h << 32) >> 32) << "u," << endl; }
{ uint128_t u = farmhashcc::CityHash128WithSeed(data + offset, len, Uint128(SEED0, SEED1)); uint64_t h = Uint128Low64(u); cout << (h >> 32) << "u, " << ((h << 32) >> 32) << "u, "; h = Uint128High64(u); cout << (h >> 32) << "u, " << ((h << 32) >> 32) ...
}

#endif

#undef SEED
#undef SEED1
#undef SEED0

}  // namespace farmhashccTest

#if !TESTING
int main(int argc, char** argv) {
  Setup();
  cout << "uint32_t expected[] = {\n";
  int i = 0;
  for ( ; i < kTestSize - 1; i++) {
    farmhashccTest::Dump(i * i, i);
  }
  for ( ; i < kDataSize; i += i / 7) {
    farmhashccTest::Dump(0, i);
  }

ext/farmhash/farmhash.cc  view on Meta::CPAN

2642662373u,
901112508u,
636035003u,
1658643797u,
172746975u,
517504890u,
3440019372u,
4144498044u,
1854755456u,
3672653905u,
4176892856u,
382159097u,
282871690u,
3629300472u,
2500754041u,
1677659759u,
1067175061u,
161654075u,
1672575536u,
346120493u,
2730229631u,
203466442u,
1244549529u,
199761971u,
2744895408u,
3195315331u,
2124618519u,
3261045496u,
985339699u,
3385585455u,
1545740710u,
3636652160u,
2167020081u,
1207897204u,
28752417u,
2895834146u,
3640845375u,
3750293073u,
548997850u,
4207814196u,
4183030708u,
2462810989u,
3929965401u,
};

// Return false only if offset is -1 and a spot check of 3 hashes all yield 0.
bool Test(int offset, int len = 0) {
#undef Check
#undef IsAlive

#define Check(x) do {                                                   \
  const uint32_t actual = (x), e = expected[index++];                   \
  bool ok = actual == e;                                                \
  if (!ok) {                                                            \
    cerr << "expected " << hex << e << " but got " << actual << endl;   \
    ++errors;                                                           \
  }                                                                     \
  assert(ok);                                                           \
} while (0)

#define IsAlive(x) do { alive += IsNonZero(x); } while (0)

  // After the following line is where the uses of "Check" and such will go.
  static int index = 0;
if (offset == -1) { int alive = 0; IsAlive(farmhashmk::Hash32WithSeed(data, len++, SEED)); IsAlive(farmhashmk::Hash32(data, len++)); IsAlive(farmhashmk::Hash32(data, len++)); len -= 3; return alive > 0; }
Check(farmhashmk::Hash32WithSeed(data + offset, len, SEED));
Check(farmhashmk::Hash32(data + offset, len));

  return true;
#undef Check
#undef IsAlive
}

int RunTest() {
  Setup();
  int i = 0;
  cout << "Running farmhashmkTest";
  if (!Test(-1)) {
    cout << "... Unavailable\n";
    return NoteErrors();
  }
  // Good.  The function is attempting to hash, so run the full test.
  int errors_prior_to_test = errors;
  for ( ; i < kTestSize - 1; i++) {
    Test(i * i, i);
  }
  for ( ; i < kDataSize; i += i / 7) {
    Test(0, i);
  }
  Test(0, kDataSize);
  cout << (errors == errors_prior_to_test ? "... OK\n" : "... Failed\n");
  return NoteErrors();
}

#else

// After the following line is where the code to print hash codes will go.
void Dump(int offset, int len) {
cout << farmhashmk::Hash32WithSeed(data + offset, len, SEED) << "u," << endl;
cout << farmhashmk::Hash32(data + offset, len) << "u," << endl;
}

#endif

#undef SEED
#undef SEED1
#undef SEED0

}  // namespace farmhashmkTest

#if !TESTING
int main(int argc, char** argv) {
  Setup();
  cout << "uint32_t expected[] = {\n";
  int i = 0;
  for ( ; i < kTestSize - 1; i++) {
    farmhashmkTest::Dump(i * i, i);
  }
  for ( ; i < kDataSize; i += i / 7) {
    farmhashmkTest::Dump(0, i);
  }
  farmhashmkTest::Dump(0, kDataSize);
  cout << "};\n";
}
#endif

ext/farmhash/farmhash.cc  view on Meta::CPAN

385182008u, 640855184u,
1327075087u, 1062468773u,
1757405994u, 1374270191u,
4263183176u, 3041193150u,
1037871524u, 3633173991u,
4231821821u, 2830131945u,
3505072908u, 2830570613u,
4195208715u, 575398021u,
3992840257u, 3691788221u,
1949847968u, 2999344380u,
3183782163u, 3723754342u,
759716128u, 3284107364u,
1714496583u, 15918244u,
820509475u, 2553936299u,
2201876606u, 4237151697u,
2605688266u, 3253705097u,
1008333207u, 712158730u,
1722280252u, 1933868287u,
4152736859u, 2097020806u,
584426382u, 2836501956u,
2522777566u, 1996172430u,
2122199776u, 1069285218u,
1474209360u, 690831894u,
107482532u, 3695525410u,
670591796u, 768977505u,
2412057331u, 3647886687u,
3110327607u, 1072658422u,
379861934u, 1557579480u,
4124127129u, 2271365865u,
3880613089u, 739218494u,
547346027u, 388559045u,
3147335977u, 176230425u,
3094853730u, 2554321205u,
1495176194u, 4093461535u,
3521297827u, 4108148413u,
1913727929u, 1177947623u,
1911655402u, 1053371241u,
3265708874u, 1266515850u,
1045540427u, 3194420196u,
3717104621u, 1144474110u,
1464392345u, 52070157u,
4144237690u, 3350490823u,
4166253320u, 2747410691u,
};

// Return false only if offset is -1 and a spot check of 3 hashes all yield 0.
bool Test(int offset, int len = 0) {
#undef Check
#undef IsAlive

#define Check(x) do {                                                   \
  const uint32_t actual = (x), e = expected[index++];                   \
  bool ok = actual == e;                                                \
  if (!ok) {                                                            \
    cerr << "expected " << hex << e << " but got " << actual << endl;   \
    ++errors;                                                           \
  }                                                                     \
  assert(ok);                                                           \
} while (0)

#define IsAlive(x) do { alive += IsNonZero(x); } while (0)

  // After the following line is where the uses of "Check" and such will go.
  static int index = 0;
if (offset == -1) { int alive = 0; { uint64_t h = farmhashna::Hash64WithSeeds(data, len++, SEED0, SEED1); IsAlive(h >> 32); IsAlive((h << 32) >> 32); } { uint64_t h = farmhashna::Hash64WithSeed(data, len++, SEED); IsAlive(h >> 32); IsAlive((h << 32) ...
{ uint64_t h = farmhashna::Hash64WithSeeds(data + offset, len, SEED0, SEED1); Check(h >> 32); Check((h << 32) >> 32); }
{ uint64_t h = farmhashna::Hash64WithSeed(data + offset, len, SEED); Check(h >> 32); Check((h << 32) >> 32); }
{ uint64_t h = farmhashna::Hash64(data + offset, len); Check(h >> 32); Check((h << 32) >> 32); }

  return true;
#undef Check
#undef IsAlive
}

int RunTest() {
  Setup();
  int i = 0;
  cout << "Running farmhashnaTest";
  if (!Test(-1)) {
    cout << "... Unavailable\n";
    return NoteErrors();
  }
  // Good.  The function is attempting to hash, so run the full test.
  int errors_prior_to_test = errors;
  for ( ; i < kTestSize - 1; i++) {
    Test(i * i, i);
  }
  for ( ; i < kDataSize; i += i / 7) {
    Test(0, i);
  }
  Test(0, kDataSize);
  cout << (errors == errors_prior_to_test ? "... OK\n" : "... Failed\n");
  return NoteErrors();
}

#else

// After the following line is where the code to print hash codes will go.
void Dump(int offset, int len) {
{ uint64_t h = farmhashna::Hash64WithSeeds(data + offset, len, SEED0, SEED1); cout << (h >> 32) << "u, " << ((h << 32) >> 32) << "u," << endl; }
{ uint64_t h = farmhashna::Hash64WithSeed(data + offset, len, SEED); cout << (h >> 32) << "u, " << ((h << 32) >> 32) << "u," << endl; }
{ uint64_t h = farmhashna::Hash64(data + offset, len); cout << (h >> 32) << "u, " << ((h << 32) >> 32) << "u," << endl; }
}

#endif

#undef SEED
#undef SEED1
#undef SEED0

}  // namespace farmhashnaTest

#if !TESTING
int main(int argc, char** argv) {
  Setup();
  cout << "uint32_t expected[] = {\n";
  int i = 0;
  for ( ; i < kTestSize - 1; i++) {
    farmhashnaTest::Dump(i * i, i);
  }
  for ( ; i < kDataSize; i += i / 7) {
    farmhashnaTest::Dump(0, i);
  }
  farmhashnaTest::Dump(0, kDataSize);
  cout << "};\n";

ext/farmhash/farmhash.cc  view on Meta::CPAN

675129307u,
3333261712u,
1154611403u,
2759854023u,
1963228038u,
505138315u,
1803966773u,
4032705384u,
798395739u,
3473799845u,
476400898u,
602972493u,
3289878097u,
2520311409u,
3214794876u,
748160407u,
1326769504u,
902775872u,
1372805534u,
1213925114u,
3009384989u,
3781981134u,
2835608783u,
2716786748u,
1669490957u,
1089334066u,
250756920u,
4041016629u,
2495807367u,
2008251381u,
106212622u,
1927268995u,
2251978818u,
3788056262u,
3678660147u,
2656772270u,
1997584981u,
2668998785u,
2954162084u,
845687881u,
776018378u,
2066910012u,
918315064u,
};

// Return false only if offset is -1 and a spot check of 3 hashes all yield 0.
bool Test(int offset, int len = 0) {
#undef Check
#undef IsAlive

#define Check(x) do {                                                   \
  const uint32_t actual = (x), e = expected[index++];                   \
  bool ok = actual == e;                                                \
  if (!ok) {                                                            \
    cerr << "expected " << hex << e << " but got " << actual << endl;   \
    ++errors;                                                           \
  }                                                                     \
  assert(ok);                                                           \
} while (0)

#define IsAlive(x) do { alive += IsNonZero(x); } while (0)

  // After the following line is where the uses of "Check" and such will go.
  static int index = 0;
if (offset == -1) { int alive = 0; IsAlive(farmhashnt::Hash32WithSeed(data, len++, SEED)); IsAlive(farmhashnt::Hash32(data, len++)); IsAlive(farmhashnt::Hash32(data, len++)); len -= 3; return alive > 0; }
Check(farmhashnt::Hash32WithSeed(data + offset, len, SEED));
Check(farmhashnt::Hash32(data + offset, len));

  return true;
#undef Check
#undef IsAlive
}

int RunTest() {
  Setup();
  int i = 0;
  cout << "Running farmhashntTest";
  if (!Test(-1)) {
    cout << "... Unavailable\n";
    return NoteErrors();
  }
  // Good.  The function is attempting to hash, so run the full test.
  int errors_prior_to_test = errors;
  for ( ; i < kTestSize - 1; i++) {
    Test(i * i, i);
  }
  for ( ; i < kDataSize; i += i / 7) {
    Test(0, i);
  }
  Test(0, kDataSize);
  cout << (errors == errors_prior_to_test ? "... OK\n" : "... Failed\n");
  return NoteErrors();
}

#else

// After the following line is where the code to print hash codes will go.
void Dump(int offset, int len) {
cout << farmhashnt::Hash32WithSeed(data + offset, len, SEED) << "u," << endl;
cout << farmhashnt::Hash32(data + offset, len) << "u," << endl;
}

#endif

#undef SEED
#undef SEED1
#undef SEED0

}  // namespace farmhashntTest

#if !TESTING
int main(int argc, char** argv) {
  Setup();
  cout << "uint32_t expected[] = {\n";
  int i = 0;
  for ( ; i < kTestSize - 1; i++) {
    farmhashntTest::Dump(i * i, i);
  }
  for ( ; i < kDataSize; i += i / 7) {
    farmhashntTest::Dump(0, i);
  }
  farmhashntTest::Dump(0, kDataSize);
  cout << "};\n";
}
#endif

ext/farmhash/farmhash.cc  view on Meta::CPAN

2771079610u,
476672419u,
2119050359u,
2918326659u,
2245402721u,
2692910474u,
2374383269u,
342400227u,
2961437795u,
3899230368u,
337787132u,
3664444935u,
1269451153u,
2971526729u,
1486511182u,
791070133u,
2570319890u,
3482497490u,
2134230518u,
4273391202u,
1825511330u,
3947753714u,
1389755724u,
3995075516u,
2081052615u,
3626343470u,
4213603435u,
2137917278u,
2898987303u,
3059215715u,
3383237881u,
3003674434u,
409174425u,
1911915604u,
2087728055u,
2942005882u,
3386522440u,
714936074u,
261924004u,
3268784033u,
1141188757u,
2413217552u,
1515163433u,
};

// Return false only if offset is -1 and a spot check of 3 hashes all yield 0.
bool Test(int offset, int len = 0) {
#undef Check
#undef IsAlive

#define Check(x) do {                                                   \
  const uint32_t actual = (x), e = expected[index++];                   \
  bool ok = actual == e;                                                \
  if (!ok) {                                                            \
    cerr << "expected " << hex << e << " but got " << actual << endl;   \
    ++errors;                                                           \
  }                                                                     \
  assert(ok);                                                           \
} while (0)

#define IsAlive(x) do { alive += IsNonZero(x); } while (0)

  // After the following line is where the uses of "Check" and such will go.
  static int index = 0;
if (offset == -1) { int alive = 0; IsAlive(farmhashsa::Hash32WithSeed(data, len++, SEED)); IsAlive(farmhashsa::Hash32(data, len++)); IsAlive(farmhashsa::Hash32(data, len++)); len -= 3; return alive > 0; }
Check(farmhashsa::Hash32WithSeed(data + offset, len, SEED));
Check(farmhashsa::Hash32(data + offset, len));

  return true;
#undef Check
#undef IsAlive
}

int RunTest() {
  Setup();
  int i = 0;
  cout << "Running farmhashsaTest";
  if (!Test(-1)) {
    cout << "... Unavailable\n";
    return NoteErrors();
  }
  // Good.  The function is attempting to hash, so run the full test.
  int errors_prior_to_test = errors;
  for ( ; i < kTestSize - 1; i++) {
    Test(i * i, i);
  }
  for ( ; i < kDataSize; i += i / 7) {
    Test(0, i);
  }
  Test(0, kDataSize);
  cout << (errors == errors_prior_to_test ? "... OK\n" : "... Failed\n");
  return NoteErrors();
}

#else

// After the following line is where the code to print hash codes will go.
void Dump(int offset, int len) {
cout << farmhashsa::Hash32WithSeed(data + offset, len, SEED) << "u," << endl;
cout << farmhashsa::Hash32(data + offset, len) << "u," << endl;
}

#endif

#undef SEED
#undef SEED1
#undef SEED0

}  // namespace farmhashsaTest

#if !TESTING
int main(int argc, char** argv) {
  Setup();
  cout << "uint32_t expected[] = {\n";
  int i = 0;
  for ( ; i < kTestSize - 1; i++) {
    farmhashsaTest::Dump(i * i, i);
  }
  for ( ; i < kDataSize; i += i / 7) {
    farmhashsaTest::Dump(0, i);
  }
  farmhashsaTest::Dump(0, kDataSize);
  cout << "};\n";
}
#endif

ext/farmhash/farmhash.cc  view on Meta::CPAN

4251291318u,
4145164938u,
1366883260u,
1912910955u,
510192669u,
1851315039u,
3574241274u,
3220062924u,
2821142039u,
1317082195u,
2274293302u,
1839219569u,
126586168u,
3989293643u,
2680178207u,
347056948u,
799681430u,
2864517481u,
3180404853u,
213140045u,
1956305184u,
1474675286u,
3085723423u,
2841859626u,
308421914u,
3670309263u,
1765052231u,
245459238u,
113434331u,
4079521092u,
2115235526u,
2943408816u,
1055476938u,
1506442339u,
2291296392u,
3267864332u,
1282145528u,
3700108015u,
1932843667u,
2677701670u,
6041177u,
3889648557u,
1461025478u,
};

// Return false only if offset is -1 and a spot check of 3 hashes all yield 0.
bool Test(int offset, int len = 0) {
#undef Check
#undef IsAlive

#define Check(x) do {                                                   \
  const uint32_t actual = (x), e = expected[index++];                   \
  bool ok = actual == e;                                                \
  if (!ok) {                                                            \
    cerr << "expected " << hex << e << " but got " << actual << endl;   \
    ++errors;                                                           \
  }                                                                     \
  assert(ok);                                                           \
} while (0)

#define IsAlive(x) do { alive += IsNonZero(x); } while (0)

  // After the following line is where the uses of "Check" and such will go.
  static int index = 0;
if (offset == -1) { int alive = 0; IsAlive(farmhashsu::Hash32WithSeed(data, len++, SEED)); IsAlive(farmhashsu::Hash32(data, len++)); IsAlive(farmhashsu::Hash32(data, len++)); len -= 3; return alive > 0; }
Check(farmhashsu::Hash32WithSeed(data + offset, len, SEED));
Check(farmhashsu::Hash32(data + offset, len));

  return true;
#undef Check
#undef IsAlive
}

int RunTest() {
  Setup();
  int i = 0;
  cout << "Running farmhashsuTest";
  if (!Test(-1)) {
    cout << "... Unavailable\n";
    return NoteErrors();
  }
  // Good.  The function is attempting to hash, so run the full test.
  int errors_prior_to_test = errors;
  for ( ; i < kTestSize - 1; i++) {
    Test(i * i, i);
  }
  for ( ; i < kDataSize; i += i / 7) {
    Test(0, i);
  }
  Test(0, kDataSize);
  cout << (errors == errors_prior_to_test ? "... OK\n" : "... Failed\n");
  return NoteErrors();
}

#else

// After the following line is where the code to print hash codes will go.
void Dump(int offset, int len) {
cout << farmhashsu::Hash32WithSeed(data + offset, len, SEED) << "u," << endl;
cout << farmhashsu::Hash32(data + offset, len) << "u," << endl;
}

#endif

#undef SEED
#undef SEED1
#undef SEED0

}  // namespace farmhashsuTest

#if !TESTING
int main(int argc, char** argv) {
  Setup();
  cout << "uint32_t expected[] = {\n";
  int i = 0;
  for ( ; i < kTestSize - 1; i++) {
    farmhashsuTest::Dump(i * i, i);
  }
  for ( ; i < kDataSize; i += i / 7) {
    farmhashsuTest::Dump(0, i);
  }
  farmhashsuTest::Dump(0, kDataSize);
  cout << "};\n";
}
#endif

ext/farmhash/farmhash.cc  view on Meta::CPAN

1968824721u, 3214794876u,
1581813122u, 2668800905u,
3297613974u, 748160407u,
1145536484u, 1326769504u,
2973323521u, 3775262814u,
3218653169u, 902775872u,
3498603433u, 1372805534u,
704686363u, 3626542352u,
2271580579u, 1213925114u,
46329775u, 3009384989u,
1330254048u, 1194824134u,
514204310u, 3781981134u,
442526164u, 2835608783u,
3460471867u, 510634034u,
546406434u, 2716786748u,
2840500021u, 1669490957u,
2536189149u, 3251421224u,
1358736072u, 1089334066u,
3260749330u, 250756920u,
2974806681u, 1513718866u,
82635635u, 4041016629u,
3391765744u, 2495807367u,
3962674316u, 2822889695u,
753413337u, 2008251381u,
3123390177u, 106212622u,
490570565u, 1684884205u,
793892547u, 1927268995u,
2344148164u, 2251978818u,
437424236u, 2774023200u,
2674940754u, 3788056262u,
2597882666u, 3678660147u,
3797434193u, 3838215866u,
279687080u, 2656772270u,
2190204787u, 1997584981u,
3384401882u, 3160208845u,
3629379425u, 2668998785u,
1050036757u, 2954162084u,
917091826u, 1744374041u,
1454282570u, 845687881u,
2997173625u, 776018378u,
1137560602u, 1938378389u,
1748082354u, 2066910012u,
2677675207u, 918315064u,
};

// Return false only if offset is -1 and a spot check of 3 hashes all yield 0.
bool Test(int offset, int len = 0) {
#undef Check
#undef IsAlive

#define Check(x) do {                                                   \
  const uint32_t actual = (x), e = expected[index++];                   \
  bool ok = actual == e;                                                \
  if (!ok) {                                                            \
    cerr << "expected " << hex << e << " but got " << actual << endl;   \
    ++errors;                                                           \
  }                                                                     \
  assert(ok);                                                           \
} while (0)

#define IsAlive(x) do { alive += IsNonZero(x); } while (0)

  // After the following line is where the uses of "Check" and such will go.
  static int index = 0;
if (offset == -1) { int alive = 0; { uint64_t h = farmhashte::Hash64WithSeeds(data, len++, SEED0, SEED1); IsAlive(h >> 32); IsAlive((h << 32) >> 32); } { uint64_t h = farmhashte::Hash64WithSeed(data, len++, SEED); IsAlive(h >> 32); IsAlive((h << 32) ...
{ uint64_t h = farmhashte::Hash64WithSeeds(data + offset, len, SEED0, SEED1); Check(h >> 32); Check((h << 32) >> 32); }
{ uint64_t h = farmhashte::Hash64WithSeed(data + offset, len, SEED); Check(h >> 32); Check((h << 32) >> 32); }
{ uint64_t h = farmhashte::Hash64(data + offset, len); Check(h >> 32); Check((h << 32) >> 32); }

  return true;
#undef Check
#undef IsAlive
}

int RunTest() {
  Setup();
  int i = 0;
  cout << "Running farmhashteTest";
  if (!Test(-1)) {
    cout << "... Unavailable\n";
    return NoteErrors();
  }
  // Good.  The function is attempting to hash, so run the full test.
  int errors_prior_to_test = errors;
  for ( ; i < kTestSize - 1; i++) {
    Test(i * i, i);
  }
  for ( ; i < kDataSize; i += i / 7) {
    Test(0, i);
  }
  Test(0, kDataSize);
  cout << (errors == errors_prior_to_test ? "... OK\n" : "... Failed\n");
  return NoteErrors();
}

#else

// After the following line is where the code to print hash codes will go.
void Dump(int offset, int len) {
{ uint64_t h = farmhashte::Hash64WithSeeds(data + offset, len, SEED0, SEED1); cout << (h >> 32) << "u, " << ((h << 32) >> 32) << "u," << endl; }
{ uint64_t h = farmhashte::Hash64WithSeed(data + offset, len, SEED); cout << (h >> 32) << "u, " << ((h << 32) >> 32) << "u," << endl; }
{ uint64_t h = farmhashte::Hash64(data + offset, len); cout << (h >> 32) << "u, " << ((h << 32) >> 32) << "u," << endl; }
}

#endif

#undef SEED
#undef SEED1
#undef SEED0

}  // namespace farmhashteTest

#if !TESTING
int main(int argc, char** argv) {
  Setup();
  cout << "uint32_t expected[] = {\n";
  int i = 0;
  for ( ; i < kTestSize - 1; i++) {
    farmhashteTest::Dump(i * i, i);
  }
  for ( ; i < kDataSize; i += i / 7) {
    farmhashteTest::Dump(0, i);
  }
  farmhashteTest::Dump(0, kDataSize);
  cout << "};\n";

ext/farmhash/farmhash.cc  view on Meta::CPAN

2122290603u, 1211197714u,
3520488321u, 3979192396u,
3540779343u, 4192918639u,
2736030448u, 1120335563u,
1698949078u, 3993310631u,
1966048551u, 2228221363u,
597941119u, 3498018399u,
393987327u, 454500547u,
1222959566u, 567151340u,
3774764786u, 1492844524u,
3308300614u, 805568076u,
868414882u, 177406999u,
1608110313u, 642061169u,
1027515771u, 3131251981u,
2851936150u, 4272755262u,
1532845092u, 709643652u,
682573592u, 1244104217u,
796769556u, 2500467040u,
3002618826u, 1112998535u,
1780193104u, 1243644607u,
3691719535u, 2958853053u,
466635014u, 2277292580u,
4082276003u, 1030800045u,
1750863246u, 379050598u,
3576413281u, 731493104u,
132259176u, 4115195437u,
1769890695u, 2715470335u,
1819263183u, 2028531518u,
2154809766u, 3672399742u,
76727603u, 4198182186u,
2304993586u, 1666387627u,
284366017u, 3359785538u,
3469807328u, 2926494787u,
3829072836u, 2493478921u,
3738499303u, 3311304980u,
932916545u, 2235559063u,
2909742396u, 1765719309u,
1456588655u, 508290328u,
1490719640u, 3356513470u,
2908490783u, 251085588u,
830410677u, 3172220325u,
3897208579u, 1940535730u,
151909546u, 2384458112u,
};

// Return false only if offset is -1 and a spot check of 3 hashes all yield 0.
bool Test(int offset, int len = 0) {
#undef Check
#undef IsAlive

#define Check(x) do {                                                   \
  const uint32_t actual = (x), e = expected[index++];                   \
  bool ok = actual == e;                                                \
  if (!ok) {                                                            \
    cerr << "expected " << hex << e << " but got " << actual << endl;   \
    ++errors;                                                           \
  }                                                                     \
  assert(ok);                                                           \
} while (0)

#define IsAlive(x) do { alive += IsNonZero(x); } while (0)

  // After the following line is where the uses of "Check" and such will go.
  static int index = 0;
if (offset == -1) { int alive = 0; { uint64_t h = farmhashuo::Hash64WithSeed(data, len++, SEED); IsAlive(h >> 32); IsAlive((h << 32) >> 32); } { uint64_t h = farmhashuo::Hash64(data, len++); IsAlive(h >> 32); IsAlive((h << 32) >> 32); } { uint64_t h ...
{ uint64_t h = farmhashuo::Hash64WithSeed(data + offset, len, SEED); Check(h >> 32); Check((h << 32) >> 32); }
{ uint64_t h = farmhashuo::Hash64(data + offset, len); Check(h >> 32); Check((h << 32) >> 32); }

  return true;
#undef Check
#undef IsAlive
}

int RunTest() {
  Setup();
  int i = 0;
  cout << "Running farmhashuoTest";
  if (!Test(-1)) {
    cout << "... Unavailable\n";
    return NoteErrors();
  }
  // Good.  The function is attempting to hash, so run the full test.
  int errors_prior_to_test = errors;
  for ( ; i < kTestSize - 1; i++) {
    Test(i * i, i);
  }
  for ( ; i < kDataSize; i += i / 7) {
    Test(0, i);
  }
  Test(0, kDataSize);
  cout << (errors == errors_prior_to_test ? "... OK\n" : "... Failed\n");
  return NoteErrors();
}

#else

// After the following line is where the code to print hash codes will go.
void Dump(int offset, int len) {
{ uint64_t h = farmhashuo::Hash64WithSeed(data + offset, len, SEED); cout << (h >> 32) << "u, " << ((h << 32) >> 32) << "u," << endl; }
{ uint64_t h = farmhashuo::Hash64(data + offset, len); cout << (h >> 32) << "u, " << ((h << 32) >> 32) << "u," << endl; }
}

#endif

#undef SEED
#undef SEED1
#undef SEED0

}  // namespace farmhashuoTest

#if !TESTING
int main(int argc, char** argv) {
  Setup();
  cout << "uint32_t expected[] = {\n";
  int i = 0;
  for ( ; i < kTestSize - 1; i++) {
    farmhashuoTest::Dump(i * i, i);
  }
  for ( ; i < kDataSize; i += i / 7) {
    farmhashuoTest::Dump(0, i);
  }
  farmhashuoTest::Dump(0, kDataSize);
  cout << "};\n";
}
#endif

ext/farmhash/farmhash.cc  view on Meta::CPAN

2851936150u, 4272755262u,
2763002551u, 1881527822u,
1532845092u, 709643652u,
682573592u, 1244104217u,
440905170u, 1111321746u,
796769556u, 2500467040u,
3002618826u, 1112998535u,
1188525643u, 4212674512u,
1780193104u, 1243644607u,
3691719535u, 2958853053u,
2813437721u, 4036584207u,
466635014u, 2277292580u,
4082276003u, 1030800045u,
1899531424u, 609466946u,
1750863246u, 379050598u,
3576413281u, 731493104u,
2707384133u, 2289193651u,
132259176u, 4115195437u,
1769890695u, 2715470335u,
3348954692u, 2166575624u,
1819263183u, 2028531518u,
2154809766u, 3672399742u,
1142139448u, 88299682u,
76727603u, 4198182186u,
2304993586u, 1666387627u,
2488475423u, 3832777692u,
284366017u, 3359785538u,
3469807328u, 2926494787u,
1914195188u, 1134129972u,
3829072836u, 2493478921u,
3738499303u, 3311304980u,
726951526u, 911080963u,
932916545u, 2235559063u,
2909742396u, 1765719309u,
465269850u, 3803621553u,
1456588655u, 508290328u,
1490719640u, 3356513470u,
2262196163u, 1451774941u,
2908490783u, 251085588u,
830410677u, 3172220325u,
4039692645u, 1383603170u,
3897208579u, 1940535730u,
151909546u, 2384458112u,
};

// Return false only if offset is -1 and a spot check of 3 hashes all yield 0.
bool Test(int offset, int len = 0) {
#undef Check
#undef IsAlive

#define Check(x) do {                                                   \
  const uint32_t actual = (x), e = expected[index++];                   \
  bool ok = actual == e;                                                \
  if (!ok) {                                                            \
    cerr << "expected " << hex << e << " but got " << actual << endl;   \
    ++errors;                                                           \
  }                                                                     \
  assert(ok);                                                           \
} while (0)

#define IsAlive(x) do { alive += IsNonZero(x); } while (0)

  // After the following line is where the uses of "Check" and such will go.
  static int index = 0;
if (offset == -1) { int alive = 0; { uint64_t h = farmhashxo::Hash64WithSeeds(data, len++, SEED0, SEED1); IsAlive(h >> 32); IsAlive((h << 32) >> 32); } { uint64_t h = farmhashxo::Hash64WithSeed(data, len++, SEED); IsAlive(h >> 32); IsAlive((h << 32) ...
{ uint64_t h = farmhashxo::Hash64WithSeeds(data + offset, len, SEED0, SEED1); Check(h >> 32); Check((h << 32) >> 32); }
{ uint64_t h = farmhashxo::Hash64WithSeed(data + offset, len, SEED); Check(h >> 32); Check((h << 32) >> 32); }
{ uint64_t h = farmhashxo::Hash64(data + offset, len); Check(h >> 32); Check((h << 32) >> 32); }

  return true;
#undef Check
#undef IsAlive
}

int RunTest() {
  Setup();
  int i = 0;
  cout << "Running farmhashxoTest";
  if (!Test(-1)) {
    cout << "... Unavailable\n";
    return NoteErrors();
  }
  // Good.  The function is attempting to hash, so run the full test.
  int errors_prior_to_test = errors;
  for ( ; i < kTestSize - 1; i++) {
    Test(i * i, i);
  }
  for ( ; i < kDataSize; i += i / 7) {
    Test(0, i);
  }
  Test(0, kDataSize);
  cout << (errors == errors_prior_to_test ? "... OK\n" : "... Failed\n");
  return NoteErrors();
}

#else

// After the following line is where the code to print hash codes will go.
void Dump(int offset, int len) {
{ uint64_t h = farmhashxo::Hash64WithSeeds(data + offset, len, SEED0, SEED1); cout << (h >> 32) << "u, " << ((h << 32) >> 32) << "u," << endl; }
{ uint64_t h = farmhashxo::Hash64WithSeed(data + offset, len, SEED); cout << (h >> 32) << "u, " << ((h << 32) >> 32) << "u," << endl; }
{ uint64_t h = farmhashxo::Hash64(data + offset, len); cout << (h >> 32) << "u, " << ((h << 32) >> 32) << "u," << endl; }
}

#endif

#undef SEED
#undef SEED1
#undef SEED0

}  // namespace farmhashxoTest

#if !TESTING
int main(int argc, char** argv) {
  Setup();
  cout << "uint32_t expected[] = {\n";
  int i = 0;
  for ( ; i < kTestSize - 1; i++) {
    farmhashxoTest::Dump(i * i, i);
  }
  for ( ; i < kDataSize; i += i / 7) {
    farmhashxoTest::Dump(0, i);
  }
  farmhashxoTest::Dump(0, kDataSize);
  cout << "};\n";



( run in 1.238 second using v1.01-cache-2.11-cpan-0bb4e1dffa6 )