Skip to content

Commit ea98ba4

Browse files
mrklineWallacoloo
authored andcommitted
FPTruncateMode: Removed unused variables on non-386
While we're at it, make fistp an inline function. Type safety is nice.
1 parent 4585a07 commit ea98ba4

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

plugins/LadspaEffect/caps/dsp/FPTruncateMode.h

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,31 +24,35 @@
2424
#define fistp(f,i) \
2525
__asm__ ("fistpl %0" : "=m" (i) : "t" (f) : "st")
2626
#else /* ! __i386__ */
27-
#define fstcw(i)
28-
#define fldcw(i)
27+
#include <cstdint>
2928

30-
#define fistp(f,i) \
31-
i = (int) f
29+
inline void fistp(float f, int32_t& i) { i = static_cast<int32_t>(f); }
3230
#endif
3331

3432
namespace DSP {
3533

3634
class FPTruncateMode
3735
{
3836
public:
39-
int cw0, cw1; /* fp control word */
37+
#ifdef __i386__
38+
int cw0; /* fp control word */
4039

4140
FPTruncateMode()
4241
{
4342
fstcw (cw0);
44-
cw1 = cw0 | 0xC00;
43+
const int cw1 = cw0 | 0xC00;
4544
fldcw (cw1);
4645
}
4746

4847
~FPTruncateMode()
4948
{
5049
fldcw (cw0);
5150
}
51+
#else
52+
// Avoid warnings about unused variables
53+
FPTruncateMode() { (void)0; }
54+
~FPTruncateMode() { (void)0; }
55+
#endif
5256
};
5357

5458
} /* namespace DSP */

0 commit comments

Comments
 (0)