mirror of
https://github.com/mackron/miniaudio.git
synced 2026-04-24 09:14:04 +02:00
Fix compilation errors relating to denormals.
* Fix an error when _MM_DENORMALS_ZERO_MASK or _MM_FLUSH_ZERO_MASK is
not supported.
* Fix compilation errors with TCC.
This commit is contained in:
+22
-1
@@ -9660,6 +9660,9 @@ static MA_INLINE void ma_yield()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#define MA_MM_DENORMALS_ZERO_MASK 0x0040
|
||||||
|
#define MA_MM_FLUSH_ZERO_MASK 0x8000
|
||||||
|
|
||||||
static MA_INLINE unsigned int ma_disable_denormals()
|
static MA_INLINE unsigned int ma_disable_denormals()
|
||||||
{
|
{
|
||||||
unsigned int prevState;
|
unsigned int prevState;
|
||||||
@@ -9686,9 +9689,18 @@ static MA_INLINE unsigned int ma_disable_denormals()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#elif defined(MA_X86) || defined(MA_X64)
|
#elif defined(MA_X86) || defined(MA_X64)
|
||||||
|
{
|
||||||
|
#if !(defined(__TINYC__)) /* <-- Add compilers that lack support for _mm_getcsr() and _mm_setcsr() to this list. */
|
||||||
{
|
{
|
||||||
prevState = _mm_getcsr();
|
prevState = _mm_getcsr();
|
||||||
_mm_setcsr(prevState | _MM_DENORMALS_ZERO_MASK | _MM_FLUSH_ZERO_MASK);
|
_mm_setcsr(prevState | MA_MM_DENORMALS_ZERO_MASK | MA_MM_FLUSH_ZERO_MASK);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
{
|
||||||
|
/* x88/64, but no support for _mm_getcsr()/_mm_setcsr(). May need to fall back to inlined assembly here. */
|
||||||
|
prevState = 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
{
|
{
|
||||||
@@ -9717,10 +9729,19 @@ static MA_INLINE void ma_restore_denormals(unsigned int prevState)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#elif defined(MA_X86) || defined(MA_X64)
|
#elif defined(MA_X86) || defined(MA_X64)
|
||||||
|
{
|
||||||
|
#if !(defined(__TINYC__)) /* <-- Add compilers that lack support for _mm_getcsr() and _mm_setcsr() to this list. */
|
||||||
{
|
{
|
||||||
_mm_setcsr(prevState);
|
_mm_setcsr(prevState);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
{
|
||||||
|
/* x88/64, but no support for _mm_getcsr()/_mm_setcsr(). May need to fall back to inlined assembly here. */
|
||||||
|
(void)prevState;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
#else
|
||||||
{
|
{
|
||||||
/* Unknown or unsupported architecture. No-op. */
|
/* Unknown or unsupported architecture. No-op. */
|
||||||
(void)prevState;
|
(void)prevState;
|
||||||
|
|||||||
Reference in New Issue
Block a user