[*] update

This commit is contained in:
Reece Wilson 2024-02-16 10:28:14 +00:00
parent 6239971ea7
commit 34c7be7958
4 changed files with 24 additions and 29 deletions

View File

@ -87,6 +87,9 @@ namespace AuHash
return hash; return hash;
} }
#else #else
// nvm lost respect for google
// maybe the above hashing algorithms could squeeze out a few more cycles on some architectures, but i doubt it.
inline _AH_HAS_RETARD_CONSTEXPR AuUInt32 ComputeUnseededHash(AuUInt32 key) inline _AH_HAS_RETARD_CONSTEXPR AuUInt32 ComputeUnseededHash(AuUInt32 key)
{ {
#if defined(_AU_HASH_RETARD_COMPILER) #if defined(_AU_HASH_RETARD_COMPILER)

View File

@ -55,26 +55,14 @@ struct AuEnableSharedFromThis : Aurora::Memory::ExSharedFromThis<X, std::enable_
#define AURORA_RUNTIME_MAKE_SHARED std::make_shared #define AURORA_RUNTIME_MAKE_SHARED std::make_shared
#endif #endif
#if defined(_AUHAS_FMT) static inline AU_NORETURN void SysPanic(const char *pMsg);
template<typename ... T>
static inline AU_NORETURN void SysPanic(T... args);
#elif !defined(AURORA_RUNTIME_MEMORY_PANIC)
namespace Aurora::Debug
{
void Panic();
}
#endif
static auline void AuMemoryPanic(const char *msg) static auline void AuMemoryPanic(const char *msg)
{ {
#if defined(AURORA_RUNTIME_MEMORY_PANIC) #if defined(AURORA_RUNTIME_MEMORY_PANIC)
AURORA_RUNTIME_MEMORY_PANIC(msg); AURORA_RUNTIME_MEMORY_PANIC(msg);
#else #else
#if defined(_AUHAS_FMT) SysPanic(msg);
SysPanic(msg);
#else
Aurora::Debug::Panic();
#endif
#endif #endif
} }
@ -239,9 +227,6 @@ constexpr AuUInt AuSizeOf(const AuSPtr<T>)
return sizeof(T); return sizeof(T);
} }
template <class ... T>
static auline void AU_NORETURN SysPanic(T... args);
template <class Z, typename T> template <class Z, typename T>
static void auline AuSafeDelete(T *in) static void auline AuSafeDelete(T *in)
{ {
@ -325,3 +310,19 @@ namespace Aurora::Memory
#endif #endif
} }
namespace AuHash
{
template <class T>
struct hash<AuSPtr<T>>
{
_AH_HAS_RETARD_CONSTEXPR AuUInt operator ()(const AuSPtr<T> &ptr) const
{
#if defined(AURORA_IS_32BIT)
return ComputeUnseededHash(AuUInt(ptr.get()));
#else
return ComputeLongHash(AuUInt(ptr.get()));
#endif
}
};
}

View File

@ -13,16 +13,7 @@
#if defined(AURORA_ROXTL_CONTAINERS_USE_PURE) #if defined(AURORA_ROXTL_CONTAINERS_USE_PURE)
using AuString = std::string; using AuString = std::string;
#elif defined(AURORA_ROXTL_STRING_USE_STR_ALLOCATOR) #elif defined(AURORA_ROXTL_STRING_USE_STR_ALLOCATOR)
template <class Base_t = std::basic_string<char, std::char_traits<char>, Aurora::Memory::StringAllocator<char>>> using AuString = std::basic_string<char, std::char_traits<char>, Aurora::Memory::StringAllocator<char>>;
struct _AuStdExString : Base_t
{
using Base_t::Base_t;
_AuStdExString(const std::string &str) : Base_t(str.begin(), str.end())
{}
};
using AuString = _AuStdExString<>;
#else #else
using AuString = std::string; using AuString = std::string;
#endif #endif

View File

@ -116,7 +116,7 @@ template <class T, class CtorCode_t = AuCtorCode_t, typename ... Args, _AU_TRYCO
inline AuPair<CtorCode_t, T> AuTryConstructWithDefaultPair(T &&def, Args&& ... args) inline AuPair<CtorCode_t, T> AuTryConstructWithDefaultPair(T &&def, Args&& ... args)
{ {
CtorCode_t code; CtorCode_t code;
T object = AuTryConstructWithDefault<T, CtorCode_t, Args...>(AuReference(code), AuFoward(def), AuForward<Args>(args)...); T object = AuTryConstructWithDefault<T, CtorCode_t, Args...>(AuReference(code), AuForward(def), AuForward<Args>(args)...);
return AuMakePair(AuMove(code), AuMove(object)); return AuMakePair(AuMove(code), AuMove(object));
} }