ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/branches/development/src/math/MersenneTwister.hpp
(Generate patch)

Comparing:
trunk/src/math/MersenneTwister.hpp (file contents), Revision 963 by tim, Wed May 17 21:51:42 2006 UTC vs.
branches/development/src/math/MersenneTwister.hpp (file contents), Revision 1767 by gezelter, Fri Jul 6 22:01:58 2012 UTC

# Line 67 | Line 67
67   #include <time.h>
68   #include <math.h>
69   #include <vector>
70 < namespace oopse {
70 > namespace OpenMD {
71  
72    class MTRand {
73      // Data
# Line 135 | Line 135 | namespace oopse {
135      uint32 loBits( const uint32& u ) const { return u & 0x7fffffffUL; }
136      uint32 mixBits( const uint32& u, const uint32& v ) const
137      { return hiBit(u) | loBits(v); }
138 + #ifdef _MSC_VER
139 + #pragma warning( push ) // save current warning settings
140 + #pragma warning( disable : 4146 ) // warning C4146: unary minus operator applied to unsigned type, result still unsigned
141 + #endif
142      uint32 twist( const uint32& m, const uint32& s0, const uint32& s1 ) const
143      { return m ^ (mixBits(s0,s1)>>1) ^ (-loBit(s1) & 0x9908b0dfUL); }
144 + #ifdef _MSC_VER
145 + #pragma warning( pop ) // return warning settings to what they were
146 + #endif
147 +
148      static uint32 hash( time_t t, clock_t c );
149    };
150  
# Line 198 | Line 206 | namespace oopse {
206     * number in the stride sequence.  
207     */
208    inline MTRand::uint32 MTRand::randInt() {
209 <
209 >
210      std::vector<uint32> ranNums(nstrides_);
211    
212      for (int i = 0; i < nstrides_; ++i) {
# Line 321 | Line 329 | namespace oopse {
329          register int i = N;
330          register bool success = true;
331          while( success && i-- )
332 <          success = fread( s++, sizeof(uint32), 1, urandom );
332 >          success = (fread( s++, sizeof(uint32), 1, urandom ) == 0);
333          fclose(urandom);
334          if( success ) { return bigSeed; }
335        }

Comparing:
trunk/src/math/MersenneTwister.hpp (property svn:keywords), Revision 963 by tim, Wed May 17 21:51:42 2006 UTC vs.
branches/development/src/math/MersenneTwister.hpp (property svn:keywords), Revision 1767 by gezelter, Fri Jul 6 22:01:58 2012 UTC

# Line 0 | Line 1
1 + Author Id Revision Date

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines