diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-07-19 18:38:52 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-07-19 18:38:52 +0400 |
commit | 7e8626bbcec21c682dc9159fe0307d157c56ede4 (patch) | |
tree | f405fd0b6ee9f0243eb5e3f7352db0842e7510b0 /source/blender/blenlib | |
parent | 21f15e2c458e277137f1791f9e60629e1e46f036 (diff) |
Code cleanup: warnings
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/intern/rand.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/source/blender/blenlib/intern/rand.c b/source/blender/blenlib/intern/rand.c index 410f98897ce..3dff0b31091 100644 --- a/source/blender/blenlib/intern/rand.c +++ b/source/blender/blenlib/intern/rand.c @@ -95,15 +95,20 @@ void BLI_rng_srandom(RNG *rng, unsigned int seed) BLI_rng_seed(rng, seed + hash[seed & 255]); } -int BLI_rng_get_int(RNG *rng) +BLI_INLINE void rng_step(RNG *rng) { rng->X = (MULTIPLIER * rng->X + ADDEND) & MASK; +} + +int BLI_rng_get_int(RNG *rng) +{ + rng_step(rng); return (int) (rng->X >> 17); } unsigned int BLI_rng_get_uint(RNG *rng) { - rng->X = (MULTIPLIER * rng->X + ADDEND) & MASK; + rng_step(rng); return (unsigned int) (rng->X >> 17); } @@ -167,10 +172,9 @@ void BLI_rng_shuffle_array(RNG *rng, void *data, unsigned int elem_size_i, unsig void BLI_rng_skip(RNG *rng, int n) { - int i; - - for (i = 0; i < n; i++) - BLI_rng_get_int(rng); + while (n--) { + rng_step(rng); + } } /***/ |