Revision: 37221
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=37221
Author:   jwilkins
Date:     2011-06-05 20:22:24 +0000 (Sun, 05 Jun 2011)
Log Message:
-----------
fixed signed/unsigned warning in MERSENNETWISTER.h

casting uint32 to int32 is safe for loBits because the value is 0 or 1, which 
is less than LONG_MAX
casting 0 or 1 back to uint32 is guaranteed by the standard to result in 0 or 
0xFFFFFFFF (respectively)
so, same results, but no warning
extra parens for readability

had to add int32 type to be used in this one place

Modified Paths:
--------------
    branches/soc-2011-onion/intern/smoke/intern/MERSENNETWISTER.h

Modified: branches/soc-2011-onion/intern/smoke/intern/MERSENNETWISTER.h
===================================================================
--- branches/soc-2011-onion/intern/smoke/intern/MERSENNETWISTER.h       
2011-06-05 19:57:11 UTC (rev 37220)
+++ branches/soc-2011-onion/intern/smoke/intern/MERSENNETWISTER.h       
2011-06-05 20:22:24 UTC (rev 37221)
@@ -73,6 +73,7 @@
 // Data
 public:
        typedef unsigned long uint32;  // unsigned integer type, at least 32 
bits
+       typedef signed long int32;     // signed integer type, at least 32 bits
        
        enum { N = 624 };       // length of state vector
        enum { SAVE = N + 1 };  // length of array for save()
@@ -132,7 +133,7 @@
        uint32 mixBits( const uint32& u, const uint32& v ) const
                { return hiBit(u) | loBits(v); }
        uint32 twist( const uint32& m, const uint32& s0, const uint32& s1 ) 
const
-               { return m ^ (mixBits(s0,s1)>>1) ^ (-loBit(s1) & 0x9908b0dfUL); 
}
+               { return m ^ (mixBits(s0,s1)>>1) ^ ((uint32)(-(int32)loBit(s1)) 
& 0x9908b0dfUL); }
        static uint32 hash( time_t t, clock_t c );
 };
 

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to