Switch to using SIMD-oriented Fast Mersenne Twister for random number generation.

In testing, reduced random number generation time by a factor of 8-10.
Drops support for processors older than Pentium 4.
Drop Mersenne Twister library; use a C++ SFMT library.

--HG--
branch : trunk
This commit is contained in:
silinoron
2010-08-19 16:13:10 -07:00
parent 21cf500cb1
commit ac59ff802b
13 changed files with 372 additions and 1561 deletions
+8 -8
View File
@@ -32,7 +32,7 @@
#include "SharedDefines.h"
#include "GridRefManager.h"
#include "MapRefManager.h"
#include "MersenneTwister.h"
#include "sfmt.h"
#include <bitset>
#include <list>
@@ -427,13 +427,13 @@ class Map : public GridRefManager<NGridType>
void UpdateIteratorBack(Player *player);
#ifdef MAP_BASED_RAND_GEN
MTRand mtRand;
int32 irand(int32 min, int32 max) { return int32 (mtRand.randInt(max - min)) + min; }
uint32 urand(uint32 min, uint32 max) { return mtRand.randInt(max - min) + min; }
int32 rand32() { return mtRand.randInt(); }
double rand_norm() { return mtRand.randExc(); }
double rand_chance() { return mtRand.randExc(100.0); }
#endif
SFMTRand sfmtRand;
int32 irand(int32 min, int32 max) { return int32(sfmtRand.IRandom(min, max)); }
uint32 urand(uint32 min, uint32 max) { return uint32(sfmtRand.URandom(min, max)); }
int32 rand32() { return int32(sfmtRand.BRandom()); }
double rand_norm() { return sfmtRand.Random(); }
double rand_chance() { return sfmtRand.Random() * 100.0; }
#endif // MAP_BASED_RAND_GEN
TempSummon *SummonCreature(uint32 entry, const Position &pos, SummonPropertiesEntry const *properties = NULL, uint32 duration = 0, Unit *summoner = NULL, uint32 vehId = 0);
Creature* GetCreature(uint64 guid);