Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
miniaudio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
miniaudio
Commits
510519fe
Commit
510519fe
authored
Aug 08, 2021
by
David Reid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix denormal control with VC6.
parent
d0285d6b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
56 additions
and
20 deletions
+56
-20
miniaudio.h
miniaudio.h
+56
-20
No files found.
miniaudio.h
View file @
510519fe
...
@@ -9663,32 +9663,68 @@ static MA_INLINE unsigned int ma_disable_denormals()
...
@@ -9663,32 +9663,68 @@ static MA_INLINE unsigned int ma_disable_denormals()
{
{
unsigned int prevState;
unsigned int prevState;
#if defined(MA_X86) || defined(MA_X64)
#if defined(_MSC_VER)
prevState = _mm_getcsr();
{
_mm_setcsr(prevState | _MM_DENORMALS_ZERO_MASK | _MM_FLUSH_ZERO_MASK);
/*
#elif defined(_MSC_VER)
Older versions of Visual Studio don't support the "safe" versions of _controlfp_s(). I don't
unsigned int unused;
know which version of Visual Studio first added support for _controlfp_s(), but I do know
_controlfp_s(&prevState, 0, 0);
that VC6 lacks support. _MSC_VER = 1200 is VC6, but if you get compilation errors on older
_controlfp_s(&unused, prevState | _DN_FLUSH, _MCW_DN);
versions of Visual Studio, let me know and I'll make the necessary adjustment.
#else
*/
/* Unknown or unsupported architecture. No-op. */
#if _MSC_VER <= 1200
prevState = 0;
{
#endif
prevState = _statusfp();
_controlfp(prevState | _DN_FLUSH, _MCW_DN);
}
#else
{
unsigned int unused;
_controlfp_s(&prevState, 0, 0);
_controlfp_s(&unused, prevState | _DN_FLUSH, _MCW_DN);
}
#endif
}
#elif defined(MA_X86) || defined(MA_X64)
{
prevState = _mm_getcsr();
_mm_setcsr(prevState | _MM_DENORMALS_ZERO_MASK | _MM_FLUSH_ZERO_MASK);
}
#else
{
/* Unknown or unsupported architecture. No-op. */
prevState = 0;
}
#endif
return prevState;
return prevState;
}
}
static MA_INLINE void ma_restore_denormals(unsigned int prevState)
static MA_INLINE void ma_restore_denormals(unsigned int prevState)
{
{
#if defined(MA_X86) || defined(MA_X64)
#if defined(_MSC_VER)
_mm_setcsr(prevState);
{
#elif defined(_MSC_VER)
/* Older versions of Visual Studio do not support _controlfp_s(). See ma_disable_denormals(). */
unsigned int unused;
#if _MSC_VER <= 1200
_controlfp_s(&unused, prevState, _MCW_DN);
{
#else
_controlfp(prevState, _MCW_DN);
/* Unknown or unsupported architecture. No-op. */
}
(void)prevState;
#else
#endif
{
unsigned int unused;
_controlfp_s(&unused, prevState, _MCW_DN);
}
#endif
}
#elif defined(MA_X86) || defined(MA_X64)
{
_mm_setcsr(prevState);
}
#else
{
/* Unknown or unsupported architecture. No-op. */
(void)prevState;
}
#endif
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment