diff options
author | Chris Robinson <[email protected]> | 2016-10-06 01:39:18 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2016-10-06 01:39:18 -0700 |
commit | 76cd6797b7e58272e4e5268f1461f209045b9de4 (patch) | |
tree | 7c16fc353376d3bec215ebe208ac7a96f6f3f205 | |
parent | 965e91c702db7b79fe70124634902712fd19b4ad (diff) |
Add some more 'restrict' keywords
-rw-r--r-- | Alc/mixer.c | 2 | ||||
-rw-r--r-- | Alc/mixer_c.c | 17 | ||||
-rw-r--r-- | Alc/mixer_defs.h | 46 | ||||
-rw-r--r-- | Alc/mixer_sse.c | 5 | ||||
-rw-r--r-- | Alc/mixer_sse2.c | 5 | ||||
-rw-r--r-- | Alc/mixer_sse3.c | 10 | ||||
-rw-r--r-- | Alc/mixer_sse41.c | 15 | ||||
-rw-r--r-- | OpenAL32/Include/alu.h | 2 |
8 files changed, 58 insertions, 44 deletions
diff --git a/Alc/mixer.c b/Alc/mixer.c index a0132e0f..b1f79d05 100644 --- a/Alc/mixer.c +++ b/Alc/mixer.c @@ -41,7 +41,7 @@ static_assert((INT_MAX>>FRACTIONBITS)/MAX_PITCH > BUFFERSIZE, "MAX_PITCH and/or BUFFERSIZE are too large for FRACTIONBITS!"); -extern inline void InitiatePositionArrays(ALuint frac, ALuint increment, ALuint *frac_arr, ALuint *pos_arr, ALuint size); +extern inline void InitiatePositionArrays(ALuint frac, ALuint increment, ALuint *restrict frac_arr, ALuint *restrict pos_arr, ALuint size); alignas(16) union ResamplerCoeffs ResampleCoeffs; diff --git a/Alc/mixer_c.c b/Alc/mixer_c.c index a75ad002..6ef818c7 100644 --- a/Alc/mixer_c.c +++ b/Alc/mixer_c.c @@ -8,17 +8,17 @@ #include "alAuxEffectSlot.h" -static inline ALfloat point32(const ALfloat *vals, ALuint UNUSED(frac)) +static inline ALfloat point32(const ALfloat *restrict vals, ALuint UNUSED(frac)) { return vals[0]; } -static inline ALfloat lerp32(const ALfloat *vals, ALuint frac) +static inline ALfloat lerp32(const ALfloat *restrict vals, ALuint frac) { return lerp(vals[0], vals[1], frac * (1.0f/FRACTIONONE)); } -static inline ALfloat fir4_32(const ALfloat *vals, ALuint frac) +static inline ALfloat fir4_32(const ALfloat *restrict vals, ALuint frac) { return resample_fir4(vals[-1], vals[0], vals[1], vals[2], frac); } -static inline ALfloat fir8_32(const ALfloat *vals, ALuint frac) +static inline ALfloat fir8_32(const ALfloat *restrict vals, ALuint frac) { return resample_fir8(vals[-3], vals[-2], vals[-1], vals[0], vals[1], vals[2], vals[3], vals[4], frac); } -const ALfloat *Resample_copy32_C(const BsincState* UNUSED(state), const ALfloat *src, ALuint UNUSED(frac), +const ALfloat *Resample_copy32_C(const BsincState* UNUSED(state), const ALfloat *restrict src, ALuint UNUSED(frac), ALuint UNUSED(increment), ALfloat *restrict dst, ALuint numsamples) { #if defined(HAVE_SSE) || defined(HAVE_NEON) @@ -32,7 +32,7 @@ const ALfloat *Resample_copy32_C(const BsincState* UNUSED(state), const ALfloat #define DECL_TEMPLATE(Sampler) \ const ALfloat *Resample_##Sampler##_C(const BsincState* UNUSED(state), \ - const ALfloat *src, ALuint frac, ALuint increment, \ + const ALfloat *restrict src, ALuint frac, ALuint increment, \ ALfloat *restrict dst, ALuint numsamples) \ { \ ALuint i; \ @@ -54,8 +54,9 @@ DECL_TEMPLATE(fir8_32) #undef DECL_TEMPLATE -const ALfloat *Resample_bsinc32_C(const BsincState *state, const ALfloat *src, ALuint frac, - ALuint increment, ALfloat *restrict dst, ALuint dstlen) +const ALfloat *Resample_bsinc32_C(const BsincState *state, const ALfloat *restrict src, + ALuint frac, ALuint increment, ALfloat *restrict dst, + ALuint dstlen) { const ALfloat *fil, *scd, *phd, *spd; const ALfloat sf = state->sf; diff --git a/Alc/mixer_defs.h b/Alc/mixer_defs.h index df449197..24916002 100644 --- a/Alc/mixer_defs.h +++ b/Alc/mixer_defs.h @@ -12,12 +12,12 @@ struct MixHrtfParams; struct HrtfState; /* C resamplers */ -const ALfloat *Resample_copy32_C(const BsincState *state, const ALfloat *src, ALuint frac, ALuint increment, ALfloat *restrict dst, ALuint dstlen); -const ALfloat *Resample_point32_C(const BsincState *state, const ALfloat *src, ALuint frac, ALuint increment, ALfloat *restrict dst, ALuint dstlen); -const ALfloat *Resample_lerp32_C(const BsincState *state, const ALfloat *src, ALuint frac, ALuint increment, ALfloat *restrict dst, ALuint dstlen); -const ALfloat *Resample_fir4_32_C(const BsincState *state, const ALfloat *src, ALuint frac, ALuint increment, ALfloat *restrict dst, ALuint dstlen); -const ALfloat *Resample_fir8_32_C(const BsincState *state, const ALfloat *src, ALuint frac, ALuint increment, ALfloat *restrict dst, ALuint dstlen); -const ALfloat *Resample_bsinc32_C(const BsincState *state, const ALfloat *src, ALuint frac, ALuint increment, ALfloat *restrict dst, ALuint dstlen); +const ALfloat *Resample_copy32_C(const BsincState *state, const ALfloat *restrict src, ALuint frac, ALuint increment, ALfloat *restrict dst, ALuint dstlen); +const ALfloat *Resample_point32_C(const BsincState *state, const ALfloat *restrict src, ALuint frac, ALuint increment, ALfloat *restrict dst, ALuint dstlen); +const ALfloat *Resample_lerp32_C(const BsincState *state, const ALfloat *restrict src, ALuint frac, ALuint increment, ALfloat *restrict dst, ALuint dstlen); +const ALfloat *Resample_fir4_32_C(const BsincState *state, const ALfloat *restrict src, ALuint frac, ALuint increment, ALfloat *restrict dst, ALuint dstlen); +const ALfloat *Resample_fir8_32_C(const BsincState *state, const ALfloat *restrict src, ALuint frac, ALuint increment, ALfloat *restrict dst, ALuint dstlen); +const ALfloat *Resample_bsinc32_C(const BsincState *state, const ALfloat *restrict src, ALuint frac, ALuint increment, ALfloat *restrict dst, ALuint dstlen); /* C mixers */ @@ -53,7 +53,7 @@ void MixRow_SSE(ALfloat *OutBuffer, const ALfloat *Gains, ALuint InPos, ALuint BufferSize); /* SSE resamplers */ -inline void InitiatePositionArrays(ALuint frac, ALuint increment, ALuint *frac_arr, ALuint *pos_arr, ALuint size) +inline void InitiatePositionArrays(ALuint frac, ALuint increment, ALuint *restrict frac_arr, ALuint *restrict pos_arr, ALuint size) { ALuint i; @@ -67,23 +67,29 @@ inline void InitiatePositionArrays(ALuint frac, ALuint increment, ALuint *frac_a } } -const ALfloat *Resample_bsinc32_SSE(const BsincState *state, const ALfloat *src, ALuint frac, +const ALfloat *Resample_bsinc32_SSE(const BsincState *state, const ALfloat *restrict src, ALuint frac, ALuint increment, ALfloat *restrict dst, ALuint dstlen); -const ALfloat *Resample_lerp32_SSE2(const BsincState *state, const ALfloat *src, ALuint frac, ALuint increment, - ALfloat *restrict dst, ALuint numsamples); -const ALfloat *Resample_lerp32_SSE41(const BsincState *state, const ALfloat *src, ALuint frac, ALuint increment, - ALfloat *restrict dst, ALuint numsamples); +const ALfloat *Resample_lerp32_SSE2(const BsincState *state, const ALfloat *restrict src, + ALuint frac, ALuint increment, ALfloat *restrict dst, + ALuint numsamples); +const ALfloat *Resample_lerp32_SSE41(const BsincState *state, const ALfloat *restrict src, + ALuint frac, ALuint increment, ALfloat *restrict dst, + ALuint numsamples); -const ALfloat *Resample_fir4_32_SSE3(const BsincState *state, const ALfloat *src, ALuint frac, ALuint increment, - ALfloat *restrict dst, ALuint numsamples); -const ALfloat *Resample_fir4_32_SSE41(const BsincState *state, const ALfloat *src, ALuint frac, ALuint increment, - ALfloat *restrict dst, ALuint numsamples); +const ALfloat *Resample_fir4_32_SSE3(const BsincState *state, const ALfloat *restrict src, + ALuint frac, ALuint increment, ALfloat *restrict dst, + ALuint numsamples); +const ALfloat *Resample_fir4_32_SSE41(const BsincState *state, const ALfloat *restrict src, + ALuint frac, ALuint increment, ALfloat *restrict dst, + ALuint numsamples); -const ALfloat *Resample_fir8_32_SSE3(const BsincState *state, const ALfloat *src, ALuint frac, ALuint increment, - ALfloat *restrict dst, ALuint numsamples); -const ALfloat *Resample_fir8_32_SSE41(const BsincState *state, const ALfloat *src, ALuint frac, ALuint increment, - ALfloat *restrict dst, ALuint numsamples); +const ALfloat *Resample_fir8_32_SSE3(const BsincState *state, const ALfloat *restrict src, + ALuint frac, ALuint increment, ALfloat *restrict dst, + ALuint numsamples); +const ALfloat *Resample_fir8_32_SSE41(const BsincState *state, const ALfloat *restrict src, + ALuint frac, ALuint increment, ALfloat *restrict dst, + ALuint numsamples); /* Neon mixers */ void MixHrtf_Neon(ALfloat (*restrict OutBuffer)[BUFFERSIZE], ALuint lidx, ALuint ridx, diff --git a/Alc/mixer_sse.c b/Alc/mixer_sse.c index 6d18a638..f5e21e23 100644 --- a/Alc/mixer_sse.c +++ b/Alc/mixer_sse.c @@ -12,8 +12,9 @@ #include "mixer_defs.h" -const ALfloat *Resample_bsinc32_SSE(const BsincState *state, const ALfloat *src, ALuint frac, - ALuint increment, ALfloat *restrict dst, ALuint dstlen) +const ALfloat *Resample_bsinc32_SSE(const BsincState *state, const ALfloat *restrict src, + ALuint frac, ALuint increment, ALfloat *restrict dst, + ALuint dstlen) { const __m128 sf4 = _mm_set1_ps(state->sf); const ALuint m = state->m; diff --git a/Alc/mixer_sse2.c b/Alc/mixer_sse2.c index 004dba9e..22a18ef3 100644 --- a/Alc/mixer_sse2.c +++ b/Alc/mixer_sse2.c @@ -27,8 +27,9 @@ #include "mixer_defs.h" -const ALfloat *Resample_lerp32_SSE2(const BsincState* UNUSED(state), const ALfloat *src, ALuint frac, ALuint increment, - ALfloat *restrict dst, ALuint numsamples) +const ALfloat *Resample_lerp32_SSE2(const BsincState* UNUSED(state), const ALfloat *restrict src, + ALuint frac, ALuint increment, ALfloat *restrict dst, + ALuint numsamples) { const __m128i increment4 = _mm_set1_epi32(increment*4); const __m128 fracOne4 = _mm_set1_ps(1.0f/FRACTIONONE); diff --git a/Alc/mixer_sse3.c b/Alc/mixer_sse3.c index 1b946461..66005e53 100644 --- a/Alc/mixer_sse3.c +++ b/Alc/mixer_sse3.c @@ -31,8 +31,9 @@ #include "mixer_defs.h" -const ALfloat *Resample_fir4_32_SSE3(const BsincState* UNUSED(state), const ALfloat *src, ALuint frac, ALuint increment, - ALfloat *restrict dst, ALuint numsamples) +const ALfloat *Resample_fir4_32_SSE3(const BsincState* UNUSED(state), const ALfloat *restrict src, + ALuint frac, ALuint increment, ALfloat *restrict dst, + ALuint numsamples) { const __m128i increment4 = _mm_set1_epi32(increment*4); const __m128i fracMask4 = _mm_set1_epi32(FRACTIONMASK); @@ -95,8 +96,9 @@ const ALfloat *Resample_fir4_32_SSE3(const BsincState* UNUSED(state), const ALfl return dst; } -const ALfloat *Resample_fir8_32_SSE3(const BsincState* UNUSED(state), const ALfloat *src, ALuint frac, ALuint increment, - ALfloat *restrict dst, ALuint numsamples) +const ALfloat *Resample_fir8_32_SSE3(const BsincState* UNUSED(state), const ALfloat *restrict src, + ALuint frac, ALuint increment, ALfloat *restrict dst, + ALuint numsamples) { const __m128i increment4 = _mm_set1_epi32(increment*4); const __m128i fracMask4 = _mm_set1_epi32(FRACTIONMASK); diff --git a/Alc/mixer_sse41.c b/Alc/mixer_sse41.c index ed49447d..7a4db6cf 100644 --- a/Alc/mixer_sse41.c +++ b/Alc/mixer_sse41.c @@ -28,8 +28,9 @@ #include "mixer_defs.h" -const ALfloat *Resample_lerp32_SSE41(const BsincState* UNUSED(state), const ALfloat *src, ALuint frac, ALuint increment, - ALfloat *restrict dst, ALuint numsamples) +const ALfloat *Resample_lerp32_SSE41(const BsincState* UNUSED(state), const ALfloat *restrict src, + ALuint frac, ALuint increment, ALfloat *restrict dst, + ALuint numsamples) { const __m128i increment4 = _mm_set1_epi32(increment*4); const __m128 fracOne4 = _mm_set1_ps(1.0f/FRACTIONONE); @@ -84,8 +85,9 @@ const ALfloat *Resample_lerp32_SSE41(const BsincState* UNUSED(state), const ALfl return dst; } -const ALfloat *Resample_fir4_32_SSE41(const BsincState* UNUSED(state), const ALfloat *src, ALuint frac, ALuint increment, - ALfloat *restrict dst, ALuint numsamples) +const ALfloat *Resample_fir4_32_SSE41(const BsincState* UNUSED(state), const ALfloat *restrict src, + ALuint frac, ALuint increment, ALfloat *restrict dst, + ALuint numsamples) { const __m128i increment4 = _mm_set1_epi32(increment*4); const __m128i fracMask4 = _mm_set1_epi32(FRACTIONMASK); @@ -151,8 +153,9 @@ const ALfloat *Resample_fir4_32_SSE41(const BsincState* UNUSED(state), const ALf return dst; } -const ALfloat *Resample_fir8_32_SSE41(const BsincState* UNUSED(state), const ALfloat *src, ALuint frac, ALuint increment, - ALfloat *restrict dst, ALuint numsamples) +const ALfloat *Resample_fir8_32_SSE41(const BsincState* UNUSED(state), const ALfloat *restrict src, + ALuint frac, ALuint increment, ALfloat *restrict dst, + ALuint numsamples) { const __m128i increment4 = _mm_set1_epi32(increment*4); const __m128i fracMask4 = _mm_set1_epi32(FRACTIONMASK); diff --git a/OpenAL32/Include/alu.h b/OpenAL32/Include/alu.h index 09c8c238..ae8645fa 100644 --- a/OpenAL32/Include/alu.h +++ b/OpenAL32/Include/alu.h @@ -149,7 +149,7 @@ typedef struct SendParams { typedef const ALfloat* (*ResamplerFunc)(const BsincState *state, - const ALfloat *src, ALuint frac, ALuint increment, ALfloat *restrict dst, ALuint dstlen + const ALfloat *restrict src, ALuint frac, ALuint increment, ALfloat *restrict dst, ALuint dstlen ); typedef void (*MixerFunc)(const ALfloat *data, ALuint OutChans, |