mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
This reverts commit ef9e7b1a1365c07ab0df2e2016c4442c3963c2c7 with the following changes to accommodate an embedder for whom the original optimizations caused issues: * Ensure stable order in the backing stores presented to the embedder. This is a pessimization that will be reverted when the embedder migrates. Tracked in https://github.com/flutter/flutter/issues/51228 * Forego the optimization where the unused layers would be collected before allocation of new layers needs to happen. This is a pessimization that will be reverted when the embedder migrates. Tracked in https://github.com/flutter/flutter/issues/51229 More context in b/146142979.
39 lines
979 B
C++
39 lines
979 B
C++
// Copyright 2013 The Flutter 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 FLUTTER_FML_HASH_COMBINE_H_
|
|
#define FLUTTER_FML_HASH_COMBINE_H_
|
|
|
|
#include <functional>
|
|
|
|
namespace fml {
|
|
|
|
template <class Type>
|
|
constexpr void HashCombineSeed(std::size_t& seed, Type arg) {
|
|
seed ^= std::hash<Type>{}(arg) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
|
}
|
|
|
|
template <class Type, class... Rest>
|
|
constexpr void HashCombineSeed(std::size_t& seed,
|
|
Type arg,
|
|
Rest... other_args) {
|
|
HashCombineSeed(seed, arg);
|
|
HashCombineSeed(seed, other_args...);
|
|
}
|
|
|
|
constexpr std::size_t HashCombine() {
|
|
return 0xdabbad00;
|
|
}
|
|
|
|
template <class... Type>
|
|
constexpr std::size_t HashCombine(Type... args) {
|
|
std::size_t seed = HashCombine();
|
|
HashCombineSeed(seed, args...);
|
|
return seed;
|
|
}
|
|
|
|
} // namespace fml
|
|
|
|
#endif // FLUTTER_FML_HASH_COMBINE_H_
|