aboutsummaryrefslogtreecommitdiff
path: root/src/common/Utilities/SFMTRand.h
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2025-07-09 12:20:10 +0200
committerShauren <shauren.trinity@gmail.com>2025-07-09 12:20:10 +0200
commit2c74626e66e5fd88683348f37f4b30ab397bf55b (patch)
tree50b4dee8256022d29c0146834ab604d16c5d9ddd /src/common/Utilities/SFMTRand.h
parentc7f5696479bb85c8fc7ee0d9fdaeb92e2b32213f (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.h16
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;
};