Skip to content

Commit

Permalink
FPTruncateMode: Removed unused variables on non-386
Browse files Browse the repository at this point in the history
While we're at it, make fistp an inline function. Type safety is nice.
  • Loading branch information
mrkline authored and Wallacoloo committed May 14, 2018
1 parent 4585a07 commit ea98ba4
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions plugins/LadspaEffect/caps/dsp/FPTruncateMode.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,31 +24,35 @@
#define fistp(f,i) \
__asm__ ("fistpl %0" : "=m" (i) : "t" (f) : "st")
#else /* ! __i386__ */
#define fstcw(i)
#define fldcw(i)
#include <cstdint>

#define fistp(f,i) \
i = (int) f
inline void fistp(float f, int32_t& i) { i = static_cast<int32_t>(f); }
#endif

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);
}

~FPTruncateMode()
{
fldcw (cw0);
}
#else
// Avoid warnings about unused variables
FPTruncateMode() { (void)0; }
~FPTruncateMode() { (void)0; }
#endif
};

} /* namespace DSP */
Expand Down

0 comments on commit ea98ba4

Please sign in to comment.