aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dep/SFMT/SFMT.h49
1 files changed, 48 insertions, 1 deletions
diff --git a/dep/SFMT/SFMT.h b/dep/SFMT/SFMT.h
index 03a7e853316..6c65cd12433 100644
--- a/dep/SFMT/SFMT.h
+++ b/dep/SFMT/SFMT.h
@@ -39,6 +39,7 @@
#include <emmintrin.h> // Define SSE2 intrinsics
#include "randomc.h" // Define integer types etc
#include <time.h>
+#include <new>
// Choose one of the possible Mersenne exponents.
// Higher values give longer cycle length and use more memory:
@@ -149,8 +150,14 @@ __m128i const &c, __m128i const &d, __m128i const &mask) {
// Class for SFMT generator
class SFMTRand { // Encapsulate random number generator
+ friend class ACE_TSS<SFMTRand>;
+
public:
- SFMTRand() { LastInterval = 0; RandomInit((int)(time(0))); }
+ SFMTRand()
+ {
+ LastInterval = 0;
+ RandomInit((int)(time(0)));
+ }
void RandomInit(int seed) // Re-seed
{
@@ -298,6 +305,46 @@ private:
ix = 0;
}
+ void* operator new(size_t size, std::nothrow_t const&)
+ {
+ return _mm_malloc(size, 16);
+ }
+
+ void operator delete(void* ptr, std::nothrow_t const&)
+ {
+ _mm_free(ptr);
+ }
+
+ void* operator new(size_t size)
+ {
+ return _mm_malloc(size, 16);
+ }
+
+ void operator delete(void* ptr)
+ {
+ _mm_free(ptr);
+ }
+
+ void* operator new[](size_t size, std::nothrow_t const&)
+ {
+ return _mm_malloc(size, 16);
+ }
+
+ void operator delete[](void* ptr, std::nothrow_t const&)
+ {
+ _mm_free(ptr);
+ }
+
+ void* operator new[](size_t size)
+ {
+ return _mm_malloc(size, 16);
+ }
+
+ void operator delete[](void* ptr)
+ {
+ _mm_free(ptr);
+ }
+
uint32_t ix; // Index into state array
uint32_t LastInterval; // Last interval length for IRandom
uint32_t RLimit; // Rejection limit used by IRandom