diff options
author | bunnei <bunneidev@gmail.com> | 2015-10-06 04:33:47 +0200 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2015-10-22 03:53:14 +0200 |
commit | c86b9d42423b5a83ccba40f828b7ad9dafe3e317 (patch) | |
tree | 04bdd0a99fa7fa36946422d0119b3d537dd99526 /src/common/common_funcs.h | |
parent | gl_rasterizer: Move logic for creating ShaderCacheKey to a static function. (diff) | |
download | yuzu-c86b9d42423b5a83ccba40f828b7ad9dafe3e317.tar yuzu-c86b9d42423b5a83ccba40f828b7ad9dafe3e317.tar.gz yuzu-c86b9d42423b5a83ccba40f828b7ad9dafe3e317.tar.bz2 yuzu-c86b9d42423b5a83ccba40f828b7ad9dafe3e317.tar.lz yuzu-c86b9d42423b5a83ccba40f828b7ad9dafe3e317.tar.xz yuzu-c86b9d42423b5a83ccba40f828b7ad9dafe3e317.tar.zst yuzu-c86b9d42423b5a83ccba40f828b7ad9dafe3e317.zip |
Diffstat (limited to '')
-rw-r--r-- | src/common/common_funcs.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/common/common_funcs.h b/src/common/common_funcs.h index ed20c3629..7a8dd39a0 100644 --- a/src/common/common_funcs.h +++ b/src/common/common_funcs.h @@ -4,6 +4,9 @@ #pragma once +#include <cstddef> +#include <functional> + #include "common_types.h" #define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0])) @@ -95,3 +98,18 @@ inline u64 _rotr64(u64 x, unsigned int shift){ // This function might change the error code. // Defined in Misc.cpp. const char* GetLastErrorMsg(); + +template <typename T> +inline std::size_t hash(const T& o) { + return std::hash<T>()(o); +} + +template <typename T> +inline std::size_t combine_hash(const T& o) { + return hash(o); +} + +template <typename T, typename... Args> +inline std::size_t combine_hash(const T& o, const Args&... args) { + return hash(o) * 3 + combine_hash(args...); +} |