[*] Force compile time optimizations under RNG

This commit is contained in:
Reece Wilson 2024-04-23 22:24:07 +01:00
parent 36f0be801c
commit 0a90fd1a25
2 changed files with 41 additions and 41 deletions

View File

@ -189,7 +189,7 @@ namespace Aurora::RNG
AuUInt32 uNext {};
while ((uNext = (uMassiveWord & (uUpperBound - 1))) > uRange)
{
uMassiveWord = AuFnv1a32Runtime(&uMassiveWord, sizeof(uMassiveWord));
uMassiveWord = AuFnv1a32Runtime<sizeof(uMassiveWord)>(&uMassiveWord);
}
return iMin + uNext;
}
@ -202,7 +202,7 @@ namespace Aurora::RNG
AuUInt32 uNext {};
while ((uNext = (uMassiveWord & (uUpperBound - 1))) > uRange)
{
uMassiveWord = AuFnv1a32Runtime(&uMassiveWord, sizeof(uMassiveWord));
uMassiveWord = AuFnv1a32Runtime<sizeof(uMassiveWord)>(&uMassiveWord);
}
return uMin + uNext;
}
@ -313,7 +313,7 @@ namespace Aurora::RNG
AuUInt32 uNext {};
while ((uNext = (uMassiveWord & (uUpperBound - 1))) > uRange)
{
uMassiveWord = AuFnv1a32Runtime(&uMassiveWord, sizeof(uMassiveWord));
uMassiveWord = AuFnv1a32Runtime<sizeof(uMassiveWord)>(&uMassiveWord);
}
ret[uIndex] = iMin + uNext;
@ -336,10 +336,10 @@ namespace Aurora::RNG
{
AuUInt32 uNext {};
uSeed = AuFnv1a32Runtime(&uSeed, sizeof(uSeed));
uSeed = AuFnv1a32Runtime<sizeof(uSeed)>(&uSeed);
while ((uNext = (uSeed & (uUpperBound - 1))) > uRange)
{
uSeed = AuFnv1a32Runtime(&uSeed, sizeof(uSeed));
uSeed = AuFnv1a32Runtime<sizeof(uSeed)>(&uSeed);
}
ret[uIndex] = iMin + uNext;
@ -366,7 +366,7 @@ namespace Aurora::RNG
AuUInt32 uNext {};
while ((uNext = (uMassiveWord & (uUpperBound - 1))) > uRange)
{
uMassiveWord = AuFnv1a32Runtime(&uMassiveWord, sizeof(uMassiveWord));
uMassiveWord = AuFnv1a32Runtime<sizeof(uMassiveWord)>(&uMassiveWord);
}
ret[uIndex] = uMin + uNext;
@ -389,10 +389,10 @@ namespace Aurora::RNG
{
AuUInt32 uNext {};
uSeed = AuFnv1a32Runtime(&uSeed, sizeof(uSeed));
uSeed = AuFnv1a32Runtime<sizeof(uSeed)>(&uSeed);
while ((uNext = (uSeed & (uUpperBound - 1))) > uRange)
{
uSeed = AuFnv1a32Runtime(&uSeed, sizeof(uSeed));
uSeed = AuFnv1a32Runtime<sizeof(uSeed)>(&uSeed);
}
ret[uIndex] = uMin + uNext;
@ -450,7 +450,7 @@ namespace Aurora::RNG
dValue *= dRange;
dValue += dMin;
ret[uIndex] = dValue;
uSeed = AuFnv1a64Runtime(&uSeed, 8);
uSeed = AuFnv1a64Runtime<8>(&uSeed);
}
return ret;
@ -480,7 +480,7 @@ namespace Aurora::RNG
AuUInt32 uNext {};
while ((uNext = (uMassiveWord & (uUpperBound - 1))) > uRange)
{
uMassiveWord = AuFnv1a64Runtime(&uMassiveWord, sizeof(uMassiveWord));
uMassiveWord = AuFnv1a64Runtime<sizeof(uMassiveWord)>(&uMassiveWord);
}
return uMin + uNext;
}
@ -493,7 +493,7 @@ namespace Aurora::RNG
AuUInt32 uNext {};
while ((uNext = (uMassiveWord & (uUpperBound - 1))) > uRange)
{
uMassiveWord = AuFnv1a64Runtime(&uMassiveWord, sizeof(uMassiveWord));
uMassiveWord = AuFnv1a64Runtime<sizeof(uMassiveWord)>(&uMassiveWord);
}
return iMin + uNext;
}
@ -512,10 +512,10 @@ namespace Aurora::RNG
{
AuUInt64 uNext {};
uSeed = AuFnv1a64Runtime(&uSeed, sizeof(uSeed));
uSeed = AuFnv1a64Runtime<sizeof(uSeed)>(&uSeed);
while ((uNext = (uSeed & (uUpperBound - 1))) > uRange)
{
uSeed = AuFnv1a64Runtime(&uSeed, sizeof(uSeed));
uSeed = AuFnv1a64Runtime<sizeof(uSeed)>(&uSeed);
}
ret[uIndex] = iMin + uNext;
@ -538,10 +538,10 @@ namespace Aurora::RNG
{
AuUInt64 uNext {};
uSeed = AuFnv1a64Runtime(&uSeed, sizeof(uSeed));
uSeed = AuFnv1a64Runtime<sizeof(uSeed)>(&uSeed);
while ((uNext = (uSeed & (uUpperBound - 1))) > uRange)
{
uSeed = AuFnv1a64Runtime(&uSeed, sizeof(uSeed));
uSeed = AuFnv1a64Runtime<sizeof(uSeed)>(&uSeed);
}
ret[uIndex] = uMin + uNext;
@ -568,7 +568,7 @@ namespace Aurora::RNG
auto uSeed = this->NextU64();
auto uComponentA = RngConvertToDecimal(uSeed);
auto uComponentB = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime(&uSeed, 8)));
auto uComponentB = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime<8>(&uSeed)));
return AuVec2 {
(uComponentA * range[0]) + min[0],
@ -597,8 +597,8 @@ namespace Aurora::RNG
auto uSeed = this->NextU64();
auto uComponentA = RngConvertToDecimal(uSeed);
auto uComponentB = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime(&uSeed, 8)));
auto uComponentC = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime(&uSeed, 8)));
auto uComponentB = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime<8>(&uSeed)));
auto uComponentC = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime<8>(&uSeed)));
return AuVec3 {
(uComponentA * range[0]) + min[0],
@ -631,9 +631,9 @@ namespace Aurora::RNG
auto uSeed = this->NextU64();
auto uComponentA = RngConvertToDecimal(uSeed);
auto uComponentB = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime(&uSeed, 8)));
auto uComponentC = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime(&uSeed, 8)));
auto uComponentD = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime(&uSeed, 8)));
auto uComponentB = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime<8>(&uSeed)));
auto uComponentC = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime<8>(&uSeed)));
auto uComponentD = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime<8>(&uSeed)));
return AuVec4 {
(uComponentA * range[0]) + min[0],
@ -661,7 +661,7 @@ namespace Aurora::RNG
AuUInt64 uNext {};
while ((uNext = (uMassiveWord & (uUpperBound - 1))) > uRange)
{
uMassiveWord = AuFnv1a64Runtime(&uMassiveWord, sizeof(uMassiveWord));
uMassiveWord = AuFnv1a64Runtime<sizeof(uMassiveWord)>(&uMassiveWord);
}
ret[uIndex] = iMin + uRange;
@ -688,7 +688,7 @@ namespace Aurora::RNG
AuUInt64 uNext {};
while ((uNext = (uMassiveWord & (uUpperBound - 1))) > uRange)
{
uMassiveWord = AuFnv1a64Runtime(&uMassiveWord, sizeof(uMassiveWord));
uMassiveWord = AuFnv1a64Runtime<sizeof(uMassiveWord)>(&uMassiveWord);
}
ret[uIndex] = uMin + uNext;
@ -764,7 +764,7 @@ namespace Aurora::RNG
{
auto uSeed = rngBytes[uIndex];
auto uComponentA = RngConvertToDecimal(uSeed);
auto uComponentB = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime(&uSeed, 8)));
auto uComponentB = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime<8>(&uSeed)));
ret[uIndex] = AuVec2 {
(uComponentA * range[0]) + min[0],
@ -789,8 +789,8 @@ namespace Aurora::RNG
for (AU_ITERATE_N(uIndex, uCount))
{
auto uComponentA = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime(&uSeed, 8)));
auto uComponentB = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime(&uSeed, 8)));
auto uComponentA = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime<8>(&uSeed)));
auto uComponentB = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime<8>(&uSeed)));
ret[uIndex] = AuVec2 {
(uComponentA * range[0]) + min[0],
@ -831,8 +831,8 @@ namespace Aurora::RNG
{
auto uSeed = rngBytes[uIndex];
auto uComponentA = RngConvertToDecimal(uSeed);
auto uComponentB = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime(&uSeed, 8)));
auto uComponentC = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime(&uSeed, 8)));
auto uComponentB = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime<8>(&uSeed)));
auto uComponentC = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime<8>(&uSeed)));
ret[uIndex] = AuVec3 {
(uComponentA * range[0]) + min[0],
@ -859,9 +859,9 @@ namespace Aurora::RNG
for (AU_ITERATE_N(uIndex, uCount))
{
auto uComponentA = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime(&uSeed, 8)));
auto uComponentB = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime(&uSeed, 8)));
auto uComponentC = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime(&uSeed, 8)));
auto uComponentA = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime<8>(&uSeed)));
auto uComponentB = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime<8>(&uSeed)));
auto uComponentC = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime<8>(&uSeed)));
ret[uIndex] = AuVec3 {
(uComponentA * range[0]) + min[0],
@ -906,9 +906,9 @@ namespace Aurora::RNG
{
auto uSeed = rngBytes[uIndex];
auto uComponentA = RngConvertToDecimal(uSeed);
auto uComponentB = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime(&uSeed, 8)));
auto uComponentC = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime(&uSeed, 8)));
auto uComponentD = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime(&uSeed, 8)));
auto uComponentB = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime<8>(&uSeed)));
auto uComponentC = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime<8>(&uSeed)));
auto uComponentD = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime<8>(&uSeed)));
ret[uIndex] = AuVec4 {
(uComponentA * range[0]) + min[0],
@ -937,10 +937,10 @@ namespace Aurora::RNG
for (AU_ITERATE_N(uIndex, uCount))
{
auto uComponentA = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime(&uSeed, 8)));
auto uComponentB = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime(&uSeed, 8)));
auto uComponentC = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime(&uSeed, 8)));
auto uComponentD = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime(&uSeed, 8)));
auto uComponentA = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime<8>(&uSeed)));
auto uComponentB = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime<8>(&uSeed)));
auto uComponentC = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime<8>(&uSeed)));
auto uComponentD = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime<8>(&uSeed)));
ret[uIndex] = AuVec4 {
(uComponentA * range[0]) + min[0],
@ -1000,7 +1000,7 @@ namespace Aurora::RNG
for (AU_ITERATE_N(uIndex, uCount))
{
ret[uIndex] = RngConvertToDecimal(uSeed);
uSeed = AuFnv1a64Runtime(&uSeed, 8);
uSeed = AuFnv1a64Runtime<8>(&uSeed);
}
return ret;
@ -1026,7 +1026,7 @@ namespace Aurora::RNG
AuUInt32 uNext {};
while ((uNext = (uMassiveWord & (uUpperBound - 1))) >= uCount)
{
uMassiveWord = AuFnv1a32Runtime(&uMassiveWord, sizeof(uMassiveWord));
uMassiveWord = AuFnv1a32Runtime<sizeof(uMassiveWord)>(&uMassiveWord);
}
return uNext;
}

View File

@ -89,7 +89,7 @@ auline AuUInt32 WELL_NextLong_Unlocked(WELLRand *rand)
a = rand->state[rand->index];
rand->state[rand->index] = a ^ b ^ d ^ (a << 2) ^ (b << 18) ^ (c << 28);
ret = rand->state[rand->index];
return AuFnv1a32Runtime(&ret, sizeof(ret));
return AuFnv1a32Runtime<sizeof(ret)>(&ret);
}
/**