FPTruncateMode: Removed unused variables on non-386

While we're at it, make fistp an inline function. Type safety is nice.
This commit is contained in:
Matt Kline
2018-05-11 23:16:19 -07:00
committed by Colin Wallace
parent 4585a07673
commit ea98ba4dae

View File

@@ -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 <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 {
@@ -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 */