1
0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-06-26 06:28:30 +02:00

Remove splitseconds lookup table and inline it

There's really no reason for this simple multiplication plus division to
be in a lookup table. The compiler will optimize it faster than putting
it in a lookup table will, I'm sure.
This commit is contained in:
Misa 2021-09-24 16:02:22 -07:00
parent f48e385e68
commit 3fcab3a395
2 changed files with 2 additions and 8 deletions

View File

@ -134,11 +134,6 @@ UtilityClass::UtilityClass(void) :
glow(0),
glowdir(0)
{
for (size_t i = 0; i < SDL_arraysize(splitseconds); i++)
{
splitseconds[i] = (i * 100) / 30;
}
slowsine = 0;
}
@ -194,14 +189,14 @@ std::string UtilityClass::timestring( int t )
if (temp < 60) //less than one minute
{
t = t % 30;
tempstring = String(temp) + ":" + twodigits(splitseconds[t]);
tempstring = String(temp) + ":" + twodigits(t * 100 / 30);
}
else
{
int temp2 = (temp - (temp % 60)) / 60;
temp = temp % 60;
t = t % 30;
tempstring = String(temp2) + ":" + twodigits(temp) + ":" + twodigits(splitseconds[t]);
tempstring = String(temp2) + ":" + twodigits(temp) + ":" + twodigits(t * 100 / 30);
}
return tempstring;
}

View File

@ -114,7 +114,6 @@ public:
int glow;
int slowsine;
int glowdir;
int splitseconds[30];
};
#ifndef HELP_DEFINITION