Used fmodf instead of fmod for a 0.5% performance increase in MixSounds

Signed-off-by: Gabriel Ravier <gabrielravier@gabrielAncientIBMv2>
This commit is contained in:
Gabriel Ravier 2020-01-29 12:47:02 +01:00 committed by Gabriel Ravier
parent bd876e9309
commit c15ecbf728

View file

@ -85,7 +85,7 @@ static void MixSounds(float *stream, unsigned int frames_total)
const float sample2 = (sound->samples[(size_t)sound->position + 1] - 128.0f) / 128.0f;
// Perform linear interpolation
const float interpolated_sample = sample1 + ((sample2 - sample1) * (float)fmod(sound->position, 1.0));
const float interpolated_sample = sample1 + ((sample2 - sample1) * fmodf(sound->position, 1.0));
*steam_pointer++ += interpolated_sample * sound->volume_l;
*steam_pointer++ += interpolated_sample * sound->volume_r;
@ -96,7 +96,7 @@ static void MixSounds(float *stream, unsigned int frames_total)
{
if (sound->looping)
{
sound->position = fmod(sound->position, (double)sound->frames);
sound->position = fmodf(sound->position, sound->frames);
}
else
{