chromium/v8/src/compiler/turboshaft/fast-hash.h

// Copyright 2022 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef V8_COMPILER_TURBOSHAFT_FAST_HASH_H_
#define V8_COMPILER_TURBOSHAFT_FAST_HASH_H_

#include <tuple>

#include "src/base/functional.h"
#include "src/base/vector.h"

namespace v8::internal::compiler::turboshaft {

// fast_hash_combine() / fast_hash_value() produce a bad but very fast to
// compute hash, intended for hash-tables and only usable for data that is
// sufficiently random already and has high variance in their low bits.

V8_INLINE size_t fast_hash_combine() {}
V8_INLINE size_t fast_hash_combine(size_t acc) {}
V8_INLINE size_t fast_hash_combine(size_t acc, size_t value) {}
template <typename T, typename... Ts>
V8_INLINE size_t fast_hash_combine(T const& v, Ts const&... vs);

template <class T>
struct fast_hash {};

fast_hash<std::pair<T1, T2>>;

fast_hash<std::tuple<Ts...>>;

template <typename T, typename... Ts>
V8_INLINE size_t fast_hash_combine(T const& v, Ts const&... vs) {}

template <typename Iterator>
V8_INLINE size_t fast_hash_range(Iterator first, Iterator last) {}

fast_hash<base::Vector<T>>;

}  // namespace v8::internal::compiler::turboshaft

#endif  // V8_COMPILER_TURBOSHAFT_FAST_HASH_H_