mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-23 10:09:43 +01: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:
parent
f48e385e68
commit
3fcab3a395
2 changed files with 2 additions and 8 deletions
|
@ -134,11 +134,6 @@ UtilityClass::UtilityClass(void) :
|
||||||
glow(0),
|
glow(0),
|
||||||
glowdir(0)
|
glowdir(0)
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i < SDL_arraysize(splitseconds); i++)
|
|
||||||
{
|
|
||||||
splitseconds[i] = (i * 100) / 30;
|
|
||||||
}
|
|
||||||
|
|
||||||
slowsine = 0;
|
slowsine = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -194,14 +189,14 @@ std::string UtilityClass::timestring( int t )
|
||||||
if (temp < 60) //less than one minute
|
if (temp < 60) //less than one minute
|
||||||
{
|
{
|
||||||
t = t % 30;
|
t = t % 30;
|
||||||
tempstring = String(temp) + ":" + twodigits(splitseconds[t]);
|
tempstring = String(temp) + ":" + twodigits(t * 100 / 30);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int temp2 = (temp - (temp % 60)) / 60;
|
int temp2 = (temp - (temp % 60)) / 60;
|
||||||
temp = temp % 60;
|
temp = temp % 60;
|
||||||
t = t % 30;
|
t = t % 30;
|
||||||
tempstring = String(temp2) + ":" + twodigits(temp) + ":" + twodigits(splitseconds[t]);
|
tempstring = String(temp2) + ":" + twodigits(temp) + ":" + twodigits(t * 100 / 30);
|
||||||
}
|
}
|
||||||
return tempstring;
|
return tempstring;
|
||||||
}
|
}
|
||||||
|
|
|
@ -114,7 +114,6 @@ public:
|
||||||
int glow;
|
int glow;
|
||||||
int slowsine;
|
int slowsine;
|
||||||
int glowdir;
|
int glowdir;
|
||||||
int splitseconds[30];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifndef HELP_DEFINITION
|
#ifndef HELP_DEFINITION
|
||||||
|
|
Loading…
Reference in a new issue