diff options
author | Shauren <shauren.trinity@gmail.com> | 2025-07-09 12:20:10 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2025-07-09 12:20:10 +0200 |
commit | 2c74626e66e5fd88683348f37f4b30ab397bf55b (patch) | |
tree | 50b4dee8256022d29c0146834ab604d16c5d9ddd /src/common/Utilities/SFMTRand.h | |
parent | c7f5696479bb85c8fc7ee0d9fdaeb92e2b32213f (diff) |
Core/Random: Use standard aligned operator new and remove RandomEngine singleton instance (it is trivially constructible)
Diffstat (limited to 'src/common/Utilities/SFMTRand.h')
-rw-r--r-- | src/common/Utilities/SFMTRand.h | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/src/common/Utilities/SFMTRand.h b/src/common/Utilities/SFMTRand.h index 7d9a820c487..26c1816f667 100644 --- a/src/common/Utilities/SFMTRand.h +++ b/src/common/Utilities/SFMTRand.h @@ -27,16 +27,12 @@ */ class SFMTRand { public: - SFMTRand(); - uint32 RandomUInt32(); // Output random bits - void* operator new(size_t size, std::nothrow_t const&); - void operator delete(void* ptr, std::nothrow_t const&); - void* operator new(size_t size); - void operator delete(void* ptr); - void* operator new[](size_t size, std::nothrow_t const&); - void operator delete[](void* ptr, std::nothrow_t const&); - void* operator new[](size_t size); - void operator delete[](void* ptr); + SFMTRand() noexcept; + uint32 RandomUInt32() noexcept; // Output random bits + void* operator new(size_t size) noexcept { return ::operator new (size, std::align_val_t(alignof(SFMTRand)), std::nothrow); } + void operator delete(void* ptr) noexcept { ::operator delete (ptr, std::align_val_t(alignof(SFMTRand)), std::nothrow); } + void* operator new[](size_t size) noexcept { return ::operator new[](size, std::align_val_t(alignof(SFMTRand)), std::nothrow); } + void operator delete[](void* ptr) noexcept { ::operator delete[](ptr, std::align_val_t(alignof(SFMTRand)), std::nothrow); } private: sfmt_t _state; }; |