diff options
-rw-r--r-- | Alc/filters/defs.h | 4 | ||||
-rw-r--r-- | Alc/filters/nfc.h | 6 | ||||
-rw-r--r-- | Alc/hrtf.h | 4 | ||||
-rw-r--r-- | CMakeLists.txt | 18 | ||||
-rw-r--r-- | OpenAL32/Include/alu.h | 24 | ||||
-rw-r--r-- | config.h.in | 3 |
6 files changed, 31 insertions, 28 deletions
diff --git a/Alc/filters/defs.h b/Alc/filters/defs.h index 133a85eb..beb4ab3e 100644 --- a/Alc/filters/defs.h +++ b/Alc/filters/defs.h @@ -84,7 +84,7 @@ inline void BiquadFilter_clear(BiquadFilter *filter) */ void BiquadFilter_setParams(BiquadFilter *filter, BiquadType type, ALfloat gain, ALfloat f0norm, ALfloat rcpQ); -inline void BiquadFilter_copyParams(BiquadFilter *restrict dst, const BiquadFilter *restrict src) +inline void BiquadFilter_copyParams(BiquadFilter *RESTRICT dst, const BiquadFilter *RESTRICT src) { dst->b0 = src->b0; dst->b1 = src->b1; @@ -93,7 +93,7 @@ inline void BiquadFilter_copyParams(BiquadFilter *restrict dst, const BiquadFilt dst->a2 = src->a2; } -void BiquadFilter_processC(BiquadFilter *filter, ALfloat *restrict dst, const ALfloat *restrict src, ALsizei numsamples); +void BiquadFilter_processC(BiquadFilter *filter, ALfloat *RESTRICT dst, const ALfloat *RESTRICT src, ALsizei numsamples); inline void BiquadFilter_passthru(BiquadFilter *filter, ALsizei numsamples) { diff --git a/Alc/filters/nfc.h b/Alc/filters/nfc.h index 12a5a18f..e02c00d8 100644 --- a/Alc/filters/nfc.h +++ b/Alc/filters/nfc.h @@ -38,12 +38,12 @@ void NfcFilterCreate(NfcFilter *nfc, const float w0, const float w1); void NfcFilterAdjust(NfcFilter *nfc, const float w0); /* Near-field control filter for first-order ambisonic channels (1-3). */ -void NfcFilterProcess1(NfcFilter *nfc, float *restrict dst, const float *restrict src, const int count); +void NfcFilterProcess1(NfcFilter *nfc, float *RESTRICT dst, const float *RESTRICT src, const int count); /* Near-field control filter for second-order ambisonic channels (4-8). */ -void NfcFilterProcess2(NfcFilter *nfc, float *restrict dst, const float *restrict src, const int count); +void NfcFilterProcess2(NfcFilter *nfc, float *RESTRICT dst, const float *RESTRICT src, const int count); /* Near-field control filter for third-order ambisonic channels (9-15). */ -void NfcFilterProcess3(NfcFilter *nfc, float *restrict dst, const float *restrict src, const int count); +void NfcFilterProcess3(NfcFilter *nfc, float *RESTRICT dst, const float *RESTRICT src, const int count); #endif /* FILTER_NFC_H */ @@ -71,7 +71,7 @@ struct Hrtf *GetLoadedHrtf(struct HrtfEntry *entry); void Hrtf_IncRef(struct Hrtf *hrtf); void Hrtf_DecRef(struct Hrtf *hrtf); -void GetHrtfCoeffs(const struct Hrtf *Hrtf, ALfloat elevation, ALfloat azimuth, ALfloat spread, ALfloat (*coeffs)[2], ALsizei *delays); +void GetHrtfCoeffs(const struct Hrtf *Hrtf, ALfloat elevation, ALfloat azimuth, ALfloat spread, ALfloat (*RESTRICT coeffs)[2], ALsizei *delays); /** * Produces HRTF filter coefficients for decoding B-Format, given a set of @@ -79,6 +79,6 @@ void GetHrtfCoeffs(const struct Hrtf *Hrtf, ALfloat elevation, ALfloat azimuth, * frequency gains for the decoder. The calculated impulse responses are * ordered and scaled according to the matrix input. */ -void BuildBFormatHrtf(const struct Hrtf *Hrtf, DirectHrtfState *state, ALsizei NumChannels, const struct AngularPoint *AmbiPoints, const ALfloat (*restrict AmbiMatrix)[MAX_AMBI_COEFFS], ALsizei AmbiCount, const ALfloat *restrict AmbiOrderHFGain); +void BuildBFormatHrtf(const struct Hrtf *Hrtf, DirectHrtfState *state, ALsizei NumChannels, const struct AngularPoint *AmbiPoints, const ALfloat (*RESTRICT AmbiMatrix)[MAX_AMBI_COEFFS], ALsizei AmbiCount, const ALfloat *RESTRICT AmbiOrderHFGain); #endif /* ALC_HRTF_H */ diff --git a/CMakeLists.txt b/CMakeLists.txt index c05bcb10..6247af93 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -155,17 +155,17 @@ ENDIF() SET(CPP_DEFS ${CPP_DEFS} _LARGEFILE_SOURCE _LARGE_FILES) SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -D_LARGEFILE_SOURCE -D_LARGE_FILES") +# C99 has restrict, but C++ does not, so we can only utilize __restrict. +SET(RESTRICT_DECL ) +CHECK_C_SOURCE_COMPILES("int *__restrict foo; + int main() {return 0;}" HAVE___RESTRICT) +IF(HAVE___RESTRICT) + SET(RESTRICT_DECL "__restrict") +ENDIF() + # MSVC may need workarounds for C99 restrict and inline IF(MSVC) - # TODO: Once we truly require C99, these restrict and inline checks should go - # away. - CHECK_C_SOURCE_COMPILES("int *restrict foo; - int main() {return 0;}" HAVE_RESTRICT) - IF(NOT HAVE_RESTRICT) - SET(CPP_DEFS ${CPP_DEFS} "restrict=") - SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Drestrict=") - ENDIF() - + # TODO: Once we truly require C99, this inline check should go away. CHECK_C_SOURCE_COMPILES("inline void foo(void) { } int main() {return 0;}" HAVE_INLINE) IF(NOT HAVE_INLINE) diff --git a/OpenAL32/Include/alu.h b/OpenAL32/Include/alu.h index c572fd71..03c388b4 100644 --- a/OpenAL32/Include/alu.h +++ b/OpenAL32/Include/alu.h @@ -87,8 +87,8 @@ typedef union InterpState { } InterpState; typedef const ALfloat* (*ResamplerFunc)(const InterpState *state, - const ALfloat *restrict src, ALsizei frac, ALint increment, - ALfloat *restrict dst, ALsizei dstlen + const ALfloat *RESTRICT src, ALsizei frac, ALint increment, + ALfloat *RESTRICT dst, ALsizei dstlen ); void BsincPrepare(const ALuint increment, BsincState *state, const struct BSincTable *table); @@ -306,25 +306,25 @@ void DeinitVoice(ALvoice *voice); typedef void (*MixerFunc)(const ALfloat *data, ALsizei OutChans, - ALfloat (*restrict OutBuffer)[BUFFERSIZE], ALfloat *CurrentGains, + ALfloat (*RESTRICT OutBuffer)[BUFFERSIZE], ALfloat *CurrentGains, const ALfloat *TargetGains, ALsizei Counter, ALsizei OutPos, ALsizei BufferSize); typedef void (*RowMixerFunc)(ALfloat *OutBuffer, const ALfloat *gains, - const ALfloat (*restrict data)[BUFFERSIZE], ALsizei InChans, + const ALfloat (*RESTRICT data)[BUFFERSIZE], ALsizei InChans, ALsizei InPos, ALsizei BufferSize); -typedef void (*HrtfMixerFunc)(ALfloat *restrict LeftOut, ALfloat *restrict RightOut, +typedef void (*HrtfMixerFunc)(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut, const ALfloat *data, ALsizei Offset, ALsizei OutPos, const ALsizei IrSize, MixHrtfParams *hrtfparams, HrtfState *hrtfstate, ALsizei BufferSize); -typedef void (*HrtfMixerBlendFunc)(ALfloat *restrict LeftOut, ALfloat *restrict RightOut, +typedef void (*HrtfMixerBlendFunc)(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut, const ALfloat *data, ALsizei Offset, ALsizei OutPos, const ALsizei IrSize, const HrtfParams *oldparams, MixHrtfParams *newparams, HrtfState *hrtfstate, ALsizei BufferSize); -typedef void (*HrtfDirectMixerFunc)(ALfloat *restrict LeftOut, ALfloat *restrict RightOut, +typedef void (*HrtfDirectMixerFunc)(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut, const ALfloat *data, ALsizei Offset, const ALsizei IrSize, - const ALfloat (*restrict Coeffs)[2], - ALfloat (*restrict Values)[2], ALsizei BufferSize); + const ALfloat (*RESTRICT Coeffs)[2], + ALfloat (*RESTRICT Values)[2], ALsizei BufferSize); #define GAIN_MIX_MAX (16.0f) /* +24dB */ @@ -491,8 +491,8 @@ inline float ScaleAzimuthFront(float azimuth, float scale) } -void ComputePanningGainsMC(const ChannelConfig *chancoeffs, ALsizei numchans, ALsizei numcoeffs, const ALfloat*restrict coeffs, ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS]); -void ComputePanningGainsBF(const BFChannelConfig *chanmap, ALsizei numchans, const ALfloat*restrict coeffs, ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS]); +void ComputePanningGainsMC(const ChannelConfig *chancoeffs, ALsizei numchans, ALsizei numcoeffs, const ALfloat*RESTRICT coeffs, ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS]); +void ComputePanningGainsBF(const BFChannelConfig *chanmap, ALsizei numchans, const ALfloat*RESTRICT coeffs, ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS]); /** * ComputePanGains @@ -502,7 +502,7 @@ void ComputePanningGainsBF(const BFChannelConfig *chanmap, ALsizei numchans, con * coeffs are a 'slice' of a transform matrix for the input channel, used to * scale and orient the sound samples. */ -inline void ComputePanGains(const MixParams *dry, const ALfloat*restrict coeffs, ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS]) +inline void ComputePanGains(const MixParams *dry, const ALfloat*RESTRICT coeffs, ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS]) { if(dry->CoeffCount > 0) ComputePanningGainsMC(dry->Ambi.Coeffs, dry->NumChannels, dry->CoeffCount, diff --git a/config.h.in b/config.h.in index 9cc6c16b..5b4bdfde 100644 --- a/config.h.in +++ b/config.h.in @@ -8,6 +8,9 @@ /* Define a built-in call indicating an aligned data pointer */ #define ASSUME_ALIGNED(x, y) ${ASSUME_ALIGNED_DECL} +/* Define a restrict macro for non-aliased pointers */ +#define RESTRICT ${RESTRICT_DECL} + /* Define if HRTF data is embedded in the library */ #cmakedefine ALSOFT_EMBED_HRTF_DATA |