]> git.tdb.fi Git - libs/gl.git/commitdiff
Perform ambient occlusion PRNG multiplication with 64-bit integers
authorMikko Rasa <tdb@tdb.fi>
Fri, 6 Jan 2017 16:16:48 +0000 (18:16 +0200)
committerMikko Rasa <tdb@tdb.fi>
Fri, 6 Jan 2017 16:16:48 +0000 (18:16 +0200)
source/ambientocclusion.cpp

index 5edbf833e32d72d7a3b1eb0393f6b9157b59bb42..3d56f3f0269c32cc128d8fc70b075547716e19d5 100644 (file)
@@ -52,7 +52,7 @@ AmbientOcclusion::AmbientOcclusion(unsigned w, unsigned h, float):
 float AmbientOcclusion::random(unsigned &seed)
 {
        static const unsigned modulus = (1U<<31)-1;
-       seed = (seed*48271)%modulus;  // minstd
+       seed = (static_cast<UInt64>(seed)*48271)%modulus;  // minstd
        return static_cast<float>(seed)/(modulus-1);
 }