1.0.0 release
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
#include "LyrebirdC.h"
|
||||
#include <fenv.h>
|
||||
|
||||
// Apple's <fenv.h> exposes two different "flush denormals to zero" environments:
|
||||
// - arm64: FE_DFL_DISABLE_DENORMS_ENV (sets FPCR.FZ)
|
||||
// - x86_64: FE_DFL_DISABLE_SSE_DENORMS_ENV (sets MXCSR.FZ + DAZ for SSE)
|
||||
// Universal-binary builds compile this TU for both archs, so each must use
|
||||
// the macro that exists on its target arch. Same end effect for SIMD float
|
||||
// math in the RT path either way.
|
||||
void lyrebird_enable_flush_to_zero(void) {
|
||||
#if defined(__arm64__)
|
||||
fesetenv(FE_DFL_DISABLE_DENORMS_ENV);
|
||||
#elif defined(__i386__) || defined(__x86_64__)
|
||||
fesetenv(FE_DFL_DISABLE_SSE_DENORMS_ENV);
|
||||
#else
|
||||
// Unsupported arch — leave FPU in default IEEE-754 mode. Denormals are
|
||||
// still processed but the build doesn't fail.
|
||||
(void)0;
|
||||
#endif
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
/// Enables flush-to-zero mode on the calling thread's floating-point unit.
|
||||
///
|
||||
/// On ARM64, sets FPCR bit 24 (FZ — flush subnormal outputs to zero).
|
||||
/// On x86-64, sets MXCSR bit 15 (FZ) and bit 6 (DAZ — treat subnormal inputs as zero).
|
||||
///
|
||||
/// Uses `fesetenv(FE_DFL_DISABLE_DENORMS_ENV)`, the macOS-standard mechanism for disabling
|
||||
/// subnormal processing. This is thread-local state; call it at the start of each audio
|
||||
/// render callback to guarantee the RT thread always runs with denormals suppressed.
|
||||
void lyrebird_enable_flush_to_zero(void);
|
||||
@@ -0,0 +1,4 @@
|
||||
module LyrebirdC {
|
||||
header "include/LyrebirdC.h"
|
||||
export *
|
||||
}
|
||||
Reference in New Issue
Block a user