feat: make rage::joaat consteval compatible (#96)
* feat(joaat): make consteval compatible * fix(ObfVar): ctime include * feat(joaat): consteval -> constexpr
This commit is contained in:
parent
2a2d9aedc7
commit
c6eb3c8c12
@ -5,7 +5,7 @@ project(GTAV-Classes)
|
||||
include(CheckIncludeFileCXX)
|
||||
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
set(CMAKE_REQUIRED_QUIET ON)
|
||||
|
@ -8,13 +8,14 @@ namespace rage
|
||||
using joaat_t = std::uint32_t;
|
||||
inline constexpr char joaat_to_lower(char c)
|
||||
{
|
||||
return (c >= 'A' && c <= 'Z') ? c + ('a' - 'A') : c;
|
||||
return c >= 'A' && c <= 'Z' ? c | 1 << 5 : c;
|
||||
}
|
||||
|
||||
inline joaat_t joaat(std::string_view str)
|
||||
inline constexpr joaat_t joaat(const std::string_view str)
|
||||
{
|
||||
joaat_t hash = 0;
|
||||
for (auto c : str) {
|
||||
for (auto c : str)
|
||||
{
|
||||
hash += joaat_to_lower(c);
|
||||
hash += (hash << 10);
|
||||
hash ^= (hash >> 6);
|
||||
|
@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include <ctime>
|
||||
|
||||
namespace rage
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user