From ea98ba4daefd4055ca98f05d31dbdd3522792a01 Mon Sep 17 00:00:00 2001 From: Matt Kline Date: Fri, 11 May 2018 23:16:19 -0700 Subject: [PATCH] FPTruncateMode: Removed unused variables on non-386 While we're at it, make fistp an inline function. Type safety is nice. --- plugins/LadspaEffect/caps/dsp/FPTruncateMode.h | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/plugins/LadspaEffect/caps/dsp/FPTruncateMode.h b/plugins/LadspaEffect/caps/dsp/FPTruncateMode.h index 354d062be03..4fd1536ffe5 100644 --- a/plugins/LadspaEffect/caps/dsp/FPTruncateMode.h +++ b/plugins/LadspaEffect/caps/dsp/FPTruncateMode.h @@ -24,11 +24,9 @@ #define fistp(f,i) \ __asm__ ("fistpl %0" : "=m" (i) : "t" (f) : "st") #else /* ! __i386__ */ - #define fstcw(i) - #define fldcw(i) + #include - #define fistp(f,i) \ - i = (int) f + inline void fistp(float f, int32_t& i) { i = static_cast(f); } #endif namespace DSP { @@ -36,12 +34,13 @@ namespace DSP { class FPTruncateMode { public: - int cw0, cw1; /* fp control word */ +#ifdef __i386__ + int cw0; /* fp control word */ FPTruncateMode() { fstcw (cw0); - cw1 = cw0 | 0xC00; + const int cw1 = cw0 | 0xC00; fldcw (cw1); } @@ -49,6 +48,11 @@ class FPTruncateMode { fldcw (cw0); } +#else + // Avoid warnings about unused variables + FPTruncateMode() { (void)0; } + ~FPTruncateMode() { (void)0; } +#endif }; } /* namespace DSP */