CPLibrary

This documentation is automatically generated by competitive-verifier/competitive-verifier

View the Project on GitHub o06660o/CPLibrary

:heavy_check_mark: src/misc/inthash.hpp

Verified with

Code

struct IntHash {
  // http://xorshift.di.unimi.it/splitmix64.c
  static uint64_t hash(uint64_t x) {
    x += 0x9e3779b97f4a7c15;
    x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
    x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
    return x ^ (x >> 31);
  }
  inline static const uint64_t SEED =
      chrono::steady_clock::now().time_since_epoch().count();
  size_t operator()(uint64_t x) const { return hash(x + SEED); }
  size_t operator()(pair<uint64_t, uint64_t> x) const {
    return hash(x.first + SEED) ^ (hash(x.second + SEED) >> 1);
  }
};
#line 1 "src/misc/inthash.hpp"
struct IntHash {
  // http://xorshift.di.unimi.it/splitmix64.c
  static uint64_t hash(uint64_t x) {
    x += 0x9e3779b97f4a7c15;
    x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
    x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
    return x ^ (x >> 31);
  }
  inline static const uint64_t SEED =
      chrono::steady_clock::now().time_since_epoch().count();
  size_t operator()(uint64_t x) const { return hash(x + SEED); }
  size_t operator()(pair<uint64_t, uint64_t> x) const {
    return hash(x.first + SEED) ^ (hash(x.second + SEED) >> 1);
  }
};
Back to top page