From a5acd4c9a3b24c9d5af3a8f504e5af053fa7fa09 Mon Sep 17 00:00:00 2001 From: boris Date: Thu, 20 Dec 2018 21:38:04 +1300 Subject: yo is this loss --- csgo-loader/csgo-client/Security/FnvHash.hpp | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'csgo-loader/csgo-client/Security/FnvHash.hpp') diff --git a/csgo-loader/csgo-client/Security/FnvHash.hpp b/csgo-loader/csgo-client/Security/FnvHash.hpp index da7e80d..35c9ad0 100644 --- a/csgo-loader/csgo-client/Security/FnvHash.hpp +++ b/csgo-loader/csgo-client/Security/FnvHash.hpp @@ -4,9 +4,11 @@ // Credits: namazso // Implements FNV-1a hash algorithm -namespace detail { +namespace detail +{ template - struct SizeDependantData { + struct SizeDependantData + { using type = Type; constexpr static auto k_offset_basis = OffsetBasis; @@ -23,7 +25,8 @@ namespace detail { struct SizeSelector<64> : SizeDependantData {}; template - class FnvHash { + class FnvHash + { private: using data_t = SizeSelector; @@ -36,14 +39,16 @@ namespace detail { public: static __forceinline constexpr auto hash_init( - ) -> hash { + ) -> hash + { return k_offset_basis; } static __forceinline constexpr auto hash_byte( hash current, std::uint8_t byte - ) -> hash { + ) -> hash + { return (current ^ byte) * k_prime; } @@ -51,7 +56,8 @@ namespace detail { static __forceinline constexpr auto hash_constexpr( const char(&str)[N], const std::size_t size = N - 1 /* do not hash the null */ - ) -> hash { + ) -> hash + { const auto prev_hash = size == 1 ? hash_init() : hash_constexpr(str, size - 1); const auto cur_hash = hash_byte(prev_hash, str[size - 1]); return cur_hash; @@ -60,7 +66,8 @@ namespace detail { static auto __forceinline hash_runtime_data( const void* data, const std::size_t sz - ) -> hash { + ) -> hash + { const auto bytes = static_cast(data); const auto end = bytes + sz; auto result = hash_init(); @@ -72,7 +79,8 @@ namespace detail { static auto __forceinline hash_runtime( const char* str - ) -> hash { + ) -> hash + { auto result = hash_init(); do result = hash_byte(result, *str++); -- cgit v1.2.3