// SkGoodHash should usually be your first choice in hashing data. // It should be both reasonably fast and high quality. struct SkGoodHash { template <typename K>
std::enable_if_t<std::has_unique_object_representations<K>::value && sizeof(K) == 4, uint32_t> operator()(const K& k) const { return SkChecksum::Mix(*(const uint32_t*)&k);
}
// The default hashing behavior in SkGoodHash requires the type to have a unique object // representation (i.e. all bits in contribute to its identity so can be hashed directly). This is // false when a struct has padding for alignment (which can be avoided by using // SK_BEGIN|END_REQUIRE_DENSE) or if the struct has floating point members since there are multiple // bit representations for NaN. // // Often Skia code has externally removed the possibility of NaN so the bit representation of a // non-NaN float will still hash correctly. SkForceDirectHash<K> produces the same as SkGoodHash // for K's that do not satisfy std::has_unique_object_representation. It should be used sparingly // and it's use may highlight design issues with the key's data that might warrant an explicitly // implemented hash function. template <typename K> struct SkForceDirectHash {
uint32_t operator()(const K& k) const { return SkChecksum::Hash32(&k, sizeof(K));
}
};
#endif
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.13 Sekunden
(vorverarbeitet am 2026-08-26)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.