From e1d8eb67a4ec48bdc929ebb9242db99bce9fcbd4 Mon Sep 17 00:00:00 2001 From: Peter Veenstra Date: Wed, 9 Oct 2019 20:49:21 +0000 Subject: [PATCH] Use fabsf when return value is a float. Small warning fix. Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@4269 --- src/dos/drive_cache.cpp | 2 +- src/hardware/joystick.cpp | 6 +++--- src/hardware/pcspeaker.cpp | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/dos/drive_cache.cpp b/src/dos/drive_cache.cpp index e0500d30..9bd548e6 100644 --- a/src/dos/drive_cache.cpp +++ b/src/dos/drive_cache.cpp @@ -243,7 +243,7 @@ void DOS_Drive_Cache::AddEntryDirOverlay(const char* path, bool checkExists) { #if defined (WIN32) //OS2 ? if (post > dironly && *(post - 1) == ':' && (post - dironly) == 2) - post++; //move away from X: as need to end up with x:\ + post++; //move away from X: as need to end up with x:\ . #else //Lets hope this is not really used.. (root folder specified as overlay) if (post == dironly) diff --git a/src/hardware/joystick.cpp b/src/hardware/joystick.cpp index b6fe5c8c..f1dc22a1 100644 --- a/src/hardware/joystick.cpp +++ b/src/hardware/joystick.cpp @@ -67,7 +67,7 @@ struct JoyStick { } void transform_circular(){ - float r = sqrt(xpos * xpos + ypos * ypos); + float r = sqrtf(xpos * xpos + ypos * ypos); if (r == 0.0) {xfinal = xpos; yfinal = ypos; return;} float deadzone_f = deadzone / 100.0f; float s = 1.0f - deadzone_f; @@ -77,8 +77,8 @@ struct JoyStick { } float deadzonescale = (r - deadzone_f) / s; //r if deadzone=0; - float xa = fabs(xpos); - float ya = fabs(ypos); + float xa = fabsf(xpos); + float ya = fabsf(ypos); float maxpos = (ya>xa?ya:xa); xfinal = xpos * deadzonescale/maxpos; yfinal = ypos * deadzonescale/maxpos; diff --git a/src/hardware/pcspeaker.cpp b/src/hardware/pcspeaker.cpp index bde5ba02..9de948ef 100644 --- a/src/hardware/pcspeaker.cpp +++ b/src/hardware/pcspeaker.cpp @@ -278,7 +278,7 @@ static void PCSPEAKER_CallBack(Bitu len) { index+=vol_len; } else { /* Check how long it will take to goto new level */ - float vol_time=fabs(vol_diff)/SPKR_SPEED; + float vol_time=fabsf(vol_diff)/SPKR_SPEED; if (vol_time<=vol_len) { /* Volume reaches endpoint in this block, calc until that point */ value+=vol_time*spkr.volcur;