text: /*
   * Copyright (C) 2018 German Mendez Bravo (Kronuz)
   *
   * Permission is hereby granted, free of charge, to any person obtaining a copy
   * of this software and associated documentation files (the "Software"), to deal
   * in the Software without restriction, including without limitation the rights
   * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
   * copies of the Software, and to permit persons to whom the Software is
   * furnished to do so, subject to the following conditions:
   *
   * The above copyright notice and this permission notice shall be included in
   * all copies or substantial portions of the Software.
   *
   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
   * THE SOFTWARE.
   */
  
  #ifndef HASHES_HH
  #define HASHES_HH
  
  template <typename T, T prime, T offset>
  struct fnv1ah {
  	using key_type = T;
  	static constexpr T hash(const char *p, std::size_t len, T seed = offset) {
  		T hash = seed;
  		for (std::size_t i = 0; i < len; ++i) {
  			hash = (hash ^ static_cast<unsigned char>(p[i])) * prime;
  		}
  		return hash;
  	}
  	template <size_t N>
  	static constexpr T hash(const char(&s)[N], T seed = offset) {
  		return hash(s, N - 1, seed);
  	}
  	static T hash(const std::string& str, T seed = offset) {
  		return hash(str.data(), str.size(), seed);
  	}
  	template <typename... Args>
  	constexpr T operator()(Args&&... args) const {
  		return hash(std::forward<Args>(args)...);
  	}
  };
  using fnv1ah32 = fnv1ah<std::uint32_t, 0x1000193UL, 2166136261UL>;
  using fnv1ah64 = fnv1ah<std::uint64_t, 0x100000001b3ULL, 14695981039346656037ULL>;
  
  constexpr std::uint32_t operator"" _fnv1a(const char* s, size_t size) {
  	return fnv1ah64::hash(s, size);
  }
  
  #endif // HASHES_HH
  