diff options
author | Robin Watts | 2008-02-17 16:12:54 +0000 |
---|---|---|
committer | Robin Watts | 2008-02-17 16:12:54 +0000 |
commit | 890bca8f7ec17d308733b5d740700807508868b9 (patch) | |
tree | 7e408e92c8788cf2ba84f7512f823c12a31ef89e /common/util.cpp | |
parent | 5b31fe75d4cf8cc7c6c0272d660ebf07a49916bd (diff) | |
download | scummvm-rg350-890bca8f7ec17d308733b5d740700807508868b9.tar.gz scummvm-rg350-890bca8f7ec17d308733b5d740700807508868b9.tar.bz2 scummvm-rg350-890bca8f7ec17d308733b5d740700807508868b9.zip |
Tweaks to fmopl; same net effect overall, just faster.
Eliminate divisions, floating point, and mod operation from inner synth loop.
svn-id: r30896
Diffstat (limited to 'common/util.cpp')
-rw-r--r-- | common/util.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/common/util.cpp b/common/util.cpp index 82a910f9a8..1f48a6ddd9 100644 --- a/common/util.cpp +++ b/common/util.cpp @@ -196,6 +196,12 @@ uint RandomSource::getRandomNumber(uint max) { return _randSeed % (max + 1); } +uint RandomSource::getRandomBit(void) { + _randSeed = 0xDEADBF03 * (_randSeed + 1); + _randSeed = (_randSeed >> 13) | (_randSeed << 19); + return _randSeed & 1; +} + uint RandomSource::getRandomNumberRng(uint min, uint max) { return getRandomNumber(max - min) + min; } |