--User changes

-Improve performance in the following variations: cpow2, dc_cube, julia3d, julia3dz, julian2, log_db, nblur, npolar, waffle, wavesn, xtrb.

--Code changes
 -Rand range now uses multiply + shift rather than modulo.
This commit is contained in:
Person
2019-07-24 18:29:33 -07:00
parent 1cafbb8837
commit 4a150132e1
9 changed files with 108 additions and 66 deletions

View File

@ -269,7 +269,7 @@ Palette<T>* PaletteList<T>::GetRandomPalette()
while (attempts < Size() * 10)
{
auto p = s_Palettes.begin();
auto paletteFileIndex = QTIsaac<ISAAC_SIZE, ISAAC_INT>::LockedRand() % Size();
auto paletteFileIndex = QTIsaac<ISAAC_SIZE, ISAAC_INT>::LockedRand(Size());
size_t i = 0;
//Move p forward i elements.
@ -281,7 +281,7 @@ Palette<T>* PaletteList<T>::GetRandomPalette()
if (i < Size())
{
size_t paletteIndex = QTIsaac<ISAAC_SIZE, ISAAC_INT>::LockedRand() % p->second.size();
size_t paletteIndex = QTIsaac<ISAAC_SIZE, ISAAC_INT>::LockedRand(p->second.size());
if (paletteIndex < p->second.size() && !p->second[paletteIndex].IsEmpty())
return &p->second[paletteIndex];