diff options
author | Chris Robinson <[email protected]> | 2013-05-28 22:27:07 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2013-05-28 22:27:07 -0700 |
commit | e96cc656e9c9176ba60cd191896fd6386a7fd74d (patch) | |
tree | b6deb2a859ca08a519f9ff2c1c3d9022eb698462 | |
parent | 48aa1e10d64d7c62cab856a0c5d7f9e140efbd6b (diff) |
Use C99's inline instead of __inline
-rw-r--r-- | Alc/ALu.c | 24 | ||||
-rw-r--r-- | Alc/effects/chorus.c | 4 | ||||
-rw-r--r-- | Alc/effects/flanger.c | 4 | ||||
-rw-r--r-- | Alc/effects/modulator.c | 6 | ||||
-rw-r--r-- | Alc/effects/reverb.c | 42 | ||||
-rw-r--r-- | Alc/mixer.c | 6 | ||||
-rw-r--r-- | Alc/mixer_c.c | 24 | ||||
-rw-r--r-- | Alc/mixer_inc.c | 18 | ||||
-rw-r--r-- | Alc/mixer_neon.c | 18 | ||||
-rw-r--r-- | Alc/mixer_sse.c | 18 | ||||
-rw-r--r-- | CMakeLists.txt | 12 | ||||
-rw-r--r-- | OpenAL32/Include/alBuffer.h | 6 | ||||
-rw-r--r-- | OpenAL32/Include/alEffect.h | 2 | ||||
-rw-r--r-- | OpenAL32/Include/alFilter.h | 4 | ||||
-rw-r--r-- | OpenAL32/Include/alMain.h | 72 | ||||
-rw-r--r-- | OpenAL32/Include/alu.h | 34 | ||||
-rw-r--r-- | OpenAL32/alAuxEffectSlot.c | 2 | ||||
-rw-r--r-- | OpenAL32/alBuffer.c | 220 |
18 files changed, 264 insertions, 252 deletions
@@ -105,20 +105,20 @@ static WetMixerFunc SelectSendMixer(void) } -static __inline void aluCrossproduct(const ALfloat *inVector1, const ALfloat *inVector2, ALfloat *outVector) +static inline void aluCrossproduct(const ALfloat *inVector1, const ALfloat *inVector2, ALfloat *outVector) { outVector[0] = inVector1[1]*inVector2[2] - inVector1[2]*inVector2[1]; outVector[1] = inVector1[2]*inVector2[0] - inVector1[0]*inVector2[2]; outVector[2] = inVector1[0]*inVector2[1] - inVector1[1]*inVector2[0]; } -static __inline ALfloat aluDotproduct(const ALfloat *inVector1, const ALfloat *inVector2) +static inline ALfloat aluDotproduct(const ALfloat *inVector1, const ALfloat *inVector2) { return inVector1[0]*inVector2[0] + inVector1[1]*inVector2[1] + inVector1[2]*inVector2[2]; } -static __inline void aluNormalize(ALfloat *inVector) +static inline void aluNormalize(ALfloat *inVector) { ALfloat lengthsqr = aluDotproduct(inVector, inVector); if(lengthsqr > 0.0f) @@ -130,7 +130,7 @@ static __inline void aluNormalize(ALfloat *inVector) } } -static __inline ALvoid aluMatrixVector(ALfloat *vector, ALfloat w, ALfloat (*restrict matrix)[4]) +static inline ALvoid aluMatrixVector(ALfloat *vector, ALfloat w, ALfloat (*restrict matrix)[4]) { ALfloat temp[4] = { vector[0], vector[1], vector[2], w @@ -917,7 +917,7 @@ ALvoid CalcSourceParams(ALsource *ALSource, const ALCcontext *ALContext) } -static __inline ALint aluF2I25(ALfloat val) +static inline ALint aluF2I25(ALfloat val) { /* Clamp the value between -1 and +1. This handles that with only a single branch. */ if(fabsf(val) > 1.0f) @@ -926,19 +926,19 @@ static __inline ALint aluF2I25(ALfloat val) return fastf2i(val*16777215.0f); } -static __inline ALfloat aluF2F(ALfloat val) +static inline ALfloat aluF2F(ALfloat val) { return val; } -static __inline ALint aluF2I(ALfloat val) +static inline ALint aluF2I(ALfloat val) { return aluF2I25(val)<<7; } -static __inline ALuint aluF2UI(ALfloat val) +static inline ALuint aluF2UI(ALfloat val) { return aluF2I(val)+2147483648u; } -static __inline ALshort aluF2S(ALfloat val) +static inline ALshort aluF2S(ALfloat val) { return aluF2I25(val)>>9; } -static __inline ALushort aluF2US(ALfloat val) +static inline ALushort aluF2US(ALfloat val) { return aluF2S(val)+32768; } -static __inline ALbyte aluF2B(ALfloat val) +static inline ALbyte aluF2B(ALfloat val) { return aluF2I25(val)>>17; } -static __inline ALubyte aluF2UB(ALfloat val) +static inline ALubyte aluF2UB(ALfloat val) { return aluF2B(val)+128; } #define DECL_TEMPLATE(T, func) \ diff --git a/Alc/effects/chorus.c b/Alc/effects/chorus.c index 34caf62d..2c3aa742 100644 --- a/Alc/effects/chorus.c +++ b/Alc/effects/chorus.c @@ -147,7 +147,7 @@ static ALvoid ALchorusState_Update(ALchorusState *state, ALCdevice *Device, cons state->lfo_disp = fastf2i(frequency / rate / (360.0f/phase)); } -static __inline void Triangle(ALint *delay_left, ALint *delay_right, ALint offset, const ALchorusState *state) +static inline void Triangle(ALint *delay_left, ALint *delay_right, ALint offset, const ALchorusState *state) { ALfloat lfo_value; @@ -162,7 +162,7 @@ static __inline void Triangle(ALint *delay_left, ALint *delay_right, ALint offse *delay_right = fastf2i(lfo_value) + state->delay; } -static __inline void Sinusoid(ALint *delay_left, ALint *delay_right, ALint offset, const ALchorusState *state) +static inline void Sinusoid(ALint *delay_left, ALint *delay_right, ALint offset, const ALchorusState *state) { ALfloat lfo_value; diff --git a/Alc/effects/flanger.c b/Alc/effects/flanger.c index 28499cd1..86b067d5 100644 --- a/Alc/effects/flanger.c +++ b/Alc/effects/flanger.c @@ -147,7 +147,7 @@ static ALvoid ALflangerState_Update(ALflangerState *state, ALCdevice *Device, co state->lfo_disp = fastf2i(frequency / rate / (360.0f/phase)); } -static __inline void Triangle(ALint *delay_left, ALint *delay_right, ALint offset, const ALflangerState *state) +static inline void Triangle(ALint *delay_left, ALint *delay_right, ALint offset, const ALflangerState *state) { ALfloat lfo_value; @@ -162,7 +162,7 @@ static __inline void Triangle(ALint *delay_left, ALint *delay_right, ALint offse *delay_right = fastf2i(lfo_value) + state->delay; } -static __inline void Sinusoid(ALint *delay_left, ALint *delay_right, ALint offset, const ALflangerState *state) +static inline void Sinusoid(ALint *delay_left, ALint *delay_right, ALint offset, const ALflangerState *state) { ALfloat lfo_value; diff --git a/Alc/effects/modulator.c b/Alc/effects/modulator.c index 930be059..d253614c 100644 --- a/Alc/effects/modulator.c +++ b/Alc/effects/modulator.c @@ -58,17 +58,17 @@ typedef struct ALmodulatorState { #define WAVEFORM_FRACONE (1<<WAVEFORM_FRACBITS) #define WAVEFORM_FRACMASK (WAVEFORM_FRACONE-1) -static __inline ALfloat Sin(ALuint index) +static inline ALfloat Sin(ALuint index) { return sinf(index * (F_PI*2.0f / WAVEFORM_FRACONE) - F_PI)*0.5f + 0.5f; } -static __inline ALfloat Saw(ALuint index) +static inline ALfloat Saw(ALuint index) { return (ALfloat)index / WAVEFORM_FRACONE; } -static __inline ALfloat Square(ALuint index) +static inline ALfloat Square(ALuint index) { return (ALfloat)((index >> (WAVEFORM_FRACBITS - 1)) & 1); } diff --git a/Alc/effects/reverb.c b/Alc/effects/reverb.c index 74f2368c..e17a0833 100644 --- a/Alc/effects/reverb.c +++ b/Alc/effects/reverb.c @@ -230,24 +230,24 @@ static const ALfloat LATE_LINE_MULTIPLIER = 4.0f; // Basic delay line input/output routines. -static __inline ALfloat DelayLineOut(DelayLine *Delay, ALuint offset) +static inline ALfloat DelayLineOut(DelayLine *Delay, ALuint offset) { return Delay->Line[offset&Delay->Mask]; } -static __inline ALvoid DelayLineIn(DelayLine *Delay, ALuint offset, ALfloat in) +static inline ALvoid DelayLineIn(DelayLine *Delay, ALuint offset, ALfloat in) { Delay->Line[offset&Delay->Mask] = in; } // Attenuated delay line output routine. -static __inline ALfloat AttenuatedDelayLineOut(DelayLine *Delay, ALuint offset, ALfloat coeff) +static inline ALfloat AttenuatedDelayLineOut(DelayLine *Delay, ALuint offset, ALfloat coeff) { return coeff * Delay->Line[offset&Delay->Mask]; } // Basic attenuated all-pass input/output routine. -static __inline ALfloat AllpassInOut(DelayLine *Delay, ALuint outOffset, ALuint inOffset, ALfloat in, ALfloat feedCoeff, ALfloat coeff) +static inline ALfloat AllpassInOut(DelayLine *Delay, ALuint outOffset, ALuint inOffset, ALfloat in, ALfloat feedCoeff, ALfloat coeff) { ALfloat out, feed; @@ -263,7 +263,7 @@ static __inline ALfloat AllpassInOut(DelayLine *Delay, ALuint outOffset, ALuint // Given an input sample, this function produces modulation for the late // reverb. -static __inline ALfloat EAXModulation(ALreverbState *State, ALfloat in) +static inline ALfloat EAXModulation(ALreverbState *State, ALfloat in) { ALfloat sinus, frac; ALuint offset; @@ -300,7 +300,7 @@ static __inline ALfloat EAXModulation(ALreverbState *State, ALfloat in) } // Delay line output routine for early reflections. -static __inline ALfloat EarlyDelayLineOut(ALreverbState *State, ALuint index) +static inline ALfloat EarlyDelayLineOut(ALreverbState *State, ALuint index) { return AttenuatedDelayLineOut(&State->Early.Delay[index], State->Offset - State->Early.Offset[index], @@ -309,7 +309,7 @@ static __inline ALfloat EarlyDelayLineOut(ALreverbState *State, ALuint index) // Given an input sample, this function produces four-channel output for the // early reflections. -static __inline ALvoid EarlyReflection(ALreverbState *State, ALfloat in, ALfloat *restrict out) +static inline ALvoid EarlyReflection(ALreverbState *State, ALfloat in, ALfloat *restrict out) { ALfloat d[4], v, f[4]; @@ -354,7 +354,7 @@ static __inline ALvoid EarlyReflection(ALreverbState *State, ALfloat in, ALfloat } // All-pass input/output routine for late reverb. -static __inline ALfloat LateAllPassInOut(ALreverbState *State, ALuint index, ALfloat in) +static inline ALfloat LateAllPassInOut(ALreverbState *State, ALuint index, ALfloat in) { return AllpassInOut(&State->Late.ApDelay[index], State->Offset - State->Late.ApOffset[index], @@ -363,7 +363,7 @@ static __inline ALfloat LateAllPassInOut(ALreverbState *State, ALuint index, ALf } // Delay line output routine for late reverb. -static __inline ALfloat LateDelayLineOut(ALreverbState *State, ALuint index) +static inline ALfloat LateDelayLineOut(ALreverbState *State, ALuint index) { return AttenuatedDelayLineOut(&State->Late.Delay[index], State->Offset - State->Late.Offset[index], @@ -371,7 +371,7 @@ static __inline ALfloat LateDelayLineOut(ALreverbState *State, ALuint index) } // Low-pass filter input/output routine for late reverb. -static __inline ALfloat LateLowPassInOut(ALreverbState *State, ALuint index, ALfloat in) +static inline ALfloat LateLowPassInOut(ALreverbState *State, ALuint index, ALfloat in) { in = lerp(in, State->Late.LpSample[index], State->Late.LpCoeff[index]); State->Late.LpSample[index] = in; @@ -380,7 +380,7 @@ static __inline ALfloat LateLowPassInOut(ALreverbState *State, ALuint index, ALf // Given four decorrelated input samples, this function produces four-channel // output for the late reverb. -static __inline ALvoid LateReverb(ALreverbState *State, const ALfloat *restrict in, ALfloat *restrict out) +static inline ALvoid LateReverb(ALreverbState *State, const ALfloat *restrict in, ALfloat *restrict out) { ALfloat d[4], f[4]; @@ -451,7 +451,7 @@ static __inline ALvoid LateReverb(ALreverbState *State, const ALfloat *restrict // Given an input sample, this function mixes echo into the four-channel late // reverb. -static __inline ALvoid EAXEcho(ALreverbState *State, ALfloat in, ALfloat *restrict late) +static inline ALvoid EAXEcho(ALreverbState *State, ALfloat in, ALfloat *restrict late) { ALfloat out, feed; @@ -485,7 +485,7 @@ static __inline ALvoid EAXEcho(ALreverbState *State, ALfloat in, ALfloat *restri // Perform the non-EAX reverb pass on a given input sample, resulting in // four-channel output. -static __inline ALvoid VerbPass(ALreverbState *State, ALfloat in, ALfloat *restrict out) +static inline ALvoid VerbPass(ALreverbState *State, ALfloat in, ALfloat *restrict out) { ALfloat feed, late[4], taps[4]; @@ -524,7 +524,7 @@ static __inline ALvoid VerbPass(ALreverbState *State, ALfloat in, ALfloat *restr // Perform the EAX reverb pass on a given input sample, resulting in four- // channel output. -static __inline ALvoid EAXVerbPass(ALreverbState *State, ALfloat in, ALfloat *restrict early, ALfloat *restrict late) +static inline ALvoid EAXVerbPass(ALreverbState *State, ALfloat in, ALfloat *restrict early, ALfloat *restrict late) { ALfloat feed, taps[4]; @@ -619,7 +619,7 @@ static ALvoid ALreverbState_Process(ALreverbState *State, ALuint SamplesToDo, co // Given the allocated sample buffer, this function updates each delay line // offset. -static __inline ALvoid RealizeLineOffset(ALfloat *sampleBuffer, DelayLine *Delay) +static inline ALvoid RealizeLineOffset(ALfloat *sampleBuffer, DelayLine *Delay) { Delay->Line = &sampleBuffer[(ALintptrEXT)Delay->Line]; } @@ -765,28 +765,28 @@ static ALboolean ALreverbState_DeviceUpdate(ALreverbState *State, ALCdevice *Dev // Calculate a decay coefficient given the length of each cycle and the time // until the decay reaches -60 dB. -static __inline ALfloat CalcDecayCoeff(ALfloat length, ALfloat decayTime) +static inline ALfloat CalcDecayCoeff(ALfloat length, ALfloat decayTime) { return powf(0.001f/*-60 dB*/, length/decayTime); } // Calculate a decay length from a coefficient and the time until the decay // reaches -60 dB. -static __inline ALfloat CalcDecayLength(ALfloat coeff, ALfloat decayTime) +static inline ALfloat CalcDecayLength(ALfloat coeff, ALfloat decayTime) { return log10f(coeff) * decayTime / log10f(0.001f)/*-60 dB*/; } // Calculate the high frequency parameter for the I3DL2 coefficient // calculation. -static __inline ALfloat CalcI3DL2HFreq(ALfloat hfRef, ALuint frequency) +static inline ALfloat CalcI3DL2HFreq(ALfloat hfRef, ALuint frequency) { return cosf(F_PI*2.0f * hfRef / frequency); } // Calculate an attenuation to be applied to the input of any echo models to // compensate for modal density and decay time. -static __inline ALfloat CalcDensityGain(ALfloat a) +static inline ALfloat CalcDensityGain(ALfloat a) { /* The energy of a signal can be obtained by finding the area under the * squared signal. This takes the form of Sum(x_n^2), where x is the @@ -805,7 +805,7 @@ static __inline ALfloat CalcDensityGain(ALfloat a) } // Calculate the mixing matrix coefficients given a diffusion factor. -static __inline ALvoid CalcMatrixCoeffs(ALfloat diffusion, ALfloat *x, ALfloat *y) +static inline ALvoid CalcMatrixCoeffs(ALfloat diffusion, ALfloat *x, ALfloat *y) { ALfloat n, t; @@ -840,7 +840,7 @@ static ALfloat CalcLimitedHfRatio(ALfloat hfRatio, ALfloat airAbsorptionGainHF, // Calculate the coefficient for a HF (and eventually LF) decay damping // filter. -static __inline ALfloat CalcDampingCoeff(ALfloat hfRatio, ALfloat length, ALfloat decayTime, ALfloat decayCoeff, ALfloat cw) +static inline ALfloat CalcDampingCoeff(ALfloat hfRatio, ALfloat length, ALfloat decayTime, ALfloat decayCoeff, ALfloat cw) { ALfloat coeff, g; diff --git a/Alc/mixer.c b/Alc/mixer.c index b9dcc1c1..0dafe874 100644 --- a/Alc/mixer.c +++ b/Alc/mixer.c @@ -37,13 +37,13 @@ #include "bs2b.h" -static __inline ALfloat Sample_ALbyte(ALbyte val) +static inline ALfloat Sample_ALbyte(ALbyte val) { return val * (1.0f/127.0f); } -static __inline ALfloat Sample_ALshort(ALshort val) +static inline ALfloat Sample_ALshort(ALshort val) { return val * (1.0f/32767.0f); } -static __inline ALfloat Sample_ALfloat(ALfloat val) +static inline ALfloat Sample_ALfloat(ALfloat val) { return val; } #define DECL_TEMPLATE(T) \ diff --git a/Alc/mixer_c.c b/Alc/mixer_c.c index 94257504..2cfbcedc 100644 --- a/Alc/mixer_c.c +++ b/Alc/mixer_c.c @@ -8,11 +8,11 @@ #include "alAuxEffectSlot.h" -static __inline ALfloat point32(const ALfloat *vals, ALuint frac) +static inline ALfloat point32(const ALfloat *vals, ALuint frac) { return vals[0]; (void)frac; } -static __inline ALfloat lerp32(const ALfloat *vals, ALuint frac) +static inline ALfloat lerp32(const ALfloat *vals, ALuint frac) { return lerp(vals[0], vals[1], frac * (1.0f/FRACTIONONE)); } -static __inline ALfloat cubic32(const ALfloat *vals, ALuint frac) +static inline ALfloat cubic32(const ALfloat *vals, ALuint frac) { return cubic(vals[-1], vals[0], vals[1], vals[2], frac * (1.0f/FRACTIONONE)); } void Resample_copy32_C(const ALfloat *data, ALuint frac, @@ -47,11 +47,11 @@ DECL_TEMPLATE(cubic32) #undef DECL_TEMPLATE -static __inline void ApplyCoeffsStep(ALuint Offset, ALfloat (*restrict Values)[2], - const ALuint IrSize, - ALfloat (*restrict Coeffs)[2], - const ALfloat (*restrict CoeffStep)[2], - ALfloat left, ALfloat right) +static inline void ApplyCoeffsStep(ALuint Offset, ALfloat (*restrict Values)[2], + const ALuint IrSize, + ALfloat (*restrict Coeffs)[2], + const ALfloat (*restrict CoeffStep)[2], + ALfloat left, ALfloat right) { ALuint c; for(c = 0;c < IrSize;c++) @@ -64,10 +64,10 @@ static __inline void ApplyCoeffsStep(ALuint Offset, ALfloat (*restrict Values)[2 } } -static __inline void ApplyCoeffs(ALuint Offset, ALfloat (*restrict Values)[2], - const ALuint IrSize, - ALfloat (*restrict Coeffs)[2], - ALfloat left, ALfloat right) +static inline void ApplyCoeffs(ALuint Offset, ALfloat (*restrict Values)[2], + const ALuint IrSize, + ALfloat (*restrict Coeffs)[2], + ALfloat left, ALfloat right) { ALuint c; for(c = 0;c < IrSize;c++) diff --git a/Alc/mixer_inc.c b/Alc/mixer_inc.c index 08387220..6cffba66 100644 --- a/Alc/mixer_inc.c +++ b/Alc/mixer_inc.c @@ -18,15 +18,15 @@ #define MixDirect_Hrtf MERGE2(MixDirect_Hrtf_,SUFFIX) -static __inline void ApplyCoeffsStep(ALuint Offset, ALfloat (*restrict Values)[2], - const ALuint irSize, - ALfloat (*restrict Coeffs)[2], - const ALfloat (*restrict CoeffStep)[2], - ALfloat left, ALfloat right); -static __inline void ApplyCoeffs(ALuint Offset, ALfloat (*restrict Values)[2], - const ALuint irSize, - ALfloat (*restrict Coeffs)[2], - ALfloat left, ALfloat right); +static inline void ApplyCoeffsStep(ALuint Offset, ALfloat (*restrict Values)[2], + const ALuint irSize, + ALfloat (*restrict Coeffs)[2], + const ALfloat (*restrict CoeffStep)[2], + ALfloat left, ALfloat right); +static inline void ApplyCoeffs(ALuint Offset, ALfloat (*restrict Values)[2], + const ALuint irSize, + ALfloat (*restrict Coeffs)[2], + ALfloat left, ALfloat right); void MixDirect_Hrtf(const DirectParams *params, const ALfloat *restrict data, ALuint srcchan, diff --git a/Alc/mixer_neon.c b/Alc/mixer_neon.c index 3006194c..4b80be5e 100644 --- a/Alc/mixer_neon.c +++ b/Alc/mixer_neon.c @@ -10,11 +10,11 @@ #include "alu.h" -static __inline void ApplyCoeffsStep(ALuint Offset, ALfloat (*restrict Values)[2], - const ALuint IrSize, - ALfloat (*restrict Coeffs)[2], - const ALfloat (*restrict CoeffStep)[2], - ALfloat left, ALfloat right) +static inline void ApplyCoeffsStep(ALuint Offset, ALfloat (*restrict Values)[2], + const ALuint IrSize, + ALfloat (*restrict Coeffs)[2], + const ALfloat (*restrict CoeffStep)[2], + ALfloat left, ALfloat right) { ALuint c; for(c = 0;c < IrSize;c++) @@ -27,10 +27,10 @@ static __inline void ApplyCoeffsStep(ALuint Offset, ALfloat (*restrict Values)[2 } } -static __inline void ApplyCoeffs(ALuint Offset, ALfloat (*restrict Values)[2], - const ALuint IrSize, - ALfloat (*restrict Coeffs)[2], - ALfloat left, ALfloat right) +static inline void ApplyCoeffs(ALuint Offset, ALfloat (*restrict Values)[2], + const ALuint IrSize, + ALfloat (*restrict Coeffs)[2], + ALfloat left, ALfloat right) { ALuint c; float32x4_t leftright4; diff --git a/Alc/mixer_sse.c b/Alc/mixer_sse.c index 2cb3db98..95893277 100644 --- a/Alc/mixer_sse.c +++ b/Alc/mixer_sse.c @@ -14,11 +14,11 @@ #include "mixer_defs.h" -static __inline void ApplyCoeffsStep(ALuint Offset, ALfloat (*restrict Values)[2], - const ALuint IrSize, - ALfloat (*restrict Coeffs)[2], - const ALfloat (*restrict CoeffStep)[2], - ALfloat left, ALfloat right) +static inline void ApplyCoeffsStep(ALuint Offset, ALfloat (*restrict Values)[2], + const ALuint IrSize, + ALfloat (*restrict Coeffs)[2], + const ALfloat (*restrict CoeffStep)[2], + ALfloat left, ALfloat right) { const __m128 lrlr = { left, right, left, right }; __m128 coeffs, deltas, imp0, imp1; @@ -76,10 +76,10 @@ static __inline void ApplyCoeffsStep(ALuint Offset, ALfloat (*restrict Values)[2 } } -static __inline void ApplyCoeffs(ALuint Offset, ALfloat (*restrict Values)[2], - const ALuint IrSize, - ALfloat (*restrict Coeffs)[2], - ALfloat left, ALfloat right) +static inline void ApplyCoeffs(ALuint Offset, ALfloat (*restrict Values)[2], + const ALuint IrSize, + ALfloat (*restrict Coeffs)[2], + ALfloat left, ALfloat right) { const __m128 lrlr = { left, right, left, right }; __m128 vals = _mm_setzero_ps(); diff --git a/CMakeLists.txt b/CMakeLists.txt index 1140b053..8fbf775b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -118,6 +118,18 @@ IF(NOT HAVE_RESTRICT) ENDIF() ENDIF() +CHECK_C_SOURCE_COMPILES("inline void foo(void) { } + int main() {return 0;}" HAVE_INLINE) +IF(NOT HAVE_INLINE) + CHECK_C_SOURCE_COMPILES("__inline void foo(void) { } + int main() {return 0;}" HAVE___INLINE) + IF(NOT HAVE___INLINE) + MESSAGE(FATAL_ERROR "No inline keyword found, please report!") + ENDIF() + + ADD_DEFINITIONS(-Dinline=__inline) +ENDIF() + # Add definitions, compiler switches, etc. INCLUDE_DIRECTORIES(OpenAL32/Include include "${OpenAL_BINARY_DIR}") diff --git a/OpenAL32/Include/alBuffer.h b/OpenAL32/Include/alBuffer.h index 8ecc4dd8..f1d64666 100644 --- a/OpenAL32/Include/alBuffer.h +++ b/OpenAL32/Include/alBuffer.h @@ -35,8 +35,8 @@ enum UserFmtChannels { ALuint BytesFromUserFmt(enum UserFmtType type); ALuint ChannelsFromUserFmt(enum UserFmtChannels chans); -static __inline ALuint FrameSizeFromUserFmt(enum UserFmtChannels chans, - enum UserFmtType type) +static inline ALuint FrameSizeFromUserFmt(enum UserFmtChannels chans, + enum UserFmtType type) { return ChannelsFromUserFmt(chans) * BytesFromUserFmt(type); } @@ -60,7 +60,7 @@ enum FmtChannels { ALuint BytesFromFmt(enum FmtType type); ALuint ChannelsFromFmt(enum FmtChannels chans); -static __inline ALuint FrameSizeFromFmt(enum FmtChannels chans, enum FmtType type) +static inline ALuint FrameSizeFromFmt(enum FmtChannels chans, enum FmtType type) { return ChannelsFromFmt(chans) * BytesFromFmt(type); } diff --git a/OpenAL32/Include/alEffect.h b/OpenAL32/Include/alEffect.h index a685681e..a1b430e9 100644 --- a/OpenAL32/Include/alEffect.h +++ b/OpenAL32/Include/alEffect.h @@ -162,7 +162,7 @@ typedef struct ALeffect { ALuint id; } ALeffect; -static __inline ALboolean IsReverbEffect(ALenum type) +static inline ALboolean IsReverbEffect(ALenum type) { return type == AL_EFFECT_REVERB || type == AL_EFFECT_EAXREVERB; } ALenum InitEffect(ALeffect *effect); diff --git a/OpenAL32/Include/alFilter.h b/OpenAL32/Include/alFilter.h index f42747f2..605c96c7 100644 --- a/OpenAL32/Include/alFilter.h +++ b/OpenAL32/Include/alFilter.h @@ -31,7 +31,7 @@ typedef struct ALfilterState { void ALfilterState_clear(ALfilterState *filter); void ALfilterState_setParams(ALfilterState *filter, ALfilterType type, ALfloat gain, ALfloat freq_scale, ALfloat bandwidth); -static __inline ALfloat ALfilterState_processSingle(ALfilterState *filter, ALfloat sample) +static inline ALfloat ALfilterState_processSingle(ALfilterState *filter, ALfloat sample) { ALfloat outsmp; @@ -48,7 +48,7 @@ static __inline ALfloat ALfilterState_processSingle(ALfilterState *filter, ALflo return outsmp; } -static __inline ALfloat ALfilterState_processSingleC(const ALfilterState *filter, ALfloat sample) +static inline ALfloat ALfilterState_processSingleC(const ALfilterState *filter, ALfloat sample) { return filter->b[0] * sample + filter->b[1] * filter->x[0] + diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h index c0c7baac..9bf10903 100644 --- a/OpenAL32/Include/alMain.h +++ b/OpenAL32/Include/alMain.h @@ -109,7 +109,7 @@ typedef LONG pthread_once_t; #define PTHREAD_ONCE_INIT 0 void pthread_once(pthread_once_t *once, void (*callback)(void)); -static __inline int sched_yield(void) +static inline int sched_yield(void) { SwitchToThread(); return 0; } #else @@ -143,31 +143,31 @@ typedef void *volatile XchgPtr; #if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)) && !defined(__QNXNTO__) typedef ALuint RefCount; -static __inline RefCount IncrementRef(volatile RefCount *ptr) +static inline RefCount IncrementRef(volatile RefCount *ptr) { return __sync_add_and_fetch(ptr, 1); } -static __inline RefCount DecrementRef(volatile RefCount *ptr) +static inline RefCount DecrementRef(volatile RefCount *ptr) { return __sync_sub_and_fetch(ptr, 1); } -static __inline int ExchangeInt(volatile int *ptr, int newval) +static inline int ExchangeInt(volatile int *ptr, int newval) { return __sync_lock_test_and_set(ptr, newval); } -static __inline void *ExchangePtr(XchgPtr *ptr, void *newval) +static inline void *ExchangePtr(XchgPtr *ptr, void *newval) { return __sync_lock_test_and_set(ptr, newval); } -static __inline ALboolean CompExchangeInt(volatile int *ptr, int oldval, int newval) +static inline ALboolean CompExchangeInt(volatile int *ptr, int oldval, int newval) { return __sync_bool_compare_and_swap(ptr, oldval, newval); } -static __inline ALboolean CompExchangePtr(XchgPtr *ptr, void *oldval, void *newval) +static inline ALboolean CompExchangePtr(XchgPtr *ptr, void *oldval, void *newval) { return __sync_bool_compare_and_swap(ptr, oldval, newval); } #elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) -static __inline int xaddl(volatile int *dest, int incr) +static inline int xaddl(volatile int *dest, int incr) { int ret; __asm__ __volatile__("lock; xaddl %0,(%1)" @@ -178,12 +178,12 @@ static __inline int xaddl(volatile int *dest, int incr) } typedef int RefCount; -static __inline RefCount IncrementRef(volatile RefCount *ptr) +static inline RefCount IncrementRef(volatile RefCount *ptr) { return xaddl(ptr, 1)+1; } -static __inline RefCount DecrementRef(volatile RefCount *ptr) +static inline RefCount DecrementRef(volatile RefCount *ptr) { return xaddl(ptr, -1)-1; } -static __inline int ExchangeInt(volatile int *dest, int newval) +static inline int ExchangeInt(volatile int *dest, int newval) { int ret; __asm__ __volatile__("lock; xchgl %0,(%1)" @@ -193,7 +193,7 @@ static __inline int ExchangeInt(volatile int *dest, int newval) return ret; } -static __inline ALboolean CompExchangeInt(volatile int *dest, int oldval, int newval) +static inline ALboolean CompExchangeInt(volatile int *dest, int oldval, int newval) { int ret; __asm__ __volatile__("lock; cmpxchgl %2,(%1)" @@ -203,7 +203,7 @@ static __inline ALboolean CompExchangeInt(volatile int *dest, int oldval, int ne return ret == oldval; } -static __inline void *ExchangePtr(XchgPtr *dest, void *newval) +static inline void *ExchangePtr(XchgPtr *dest, void *newval) { void *ret; __asm__ __volatile__( @@ -219,7 +219,7 @@ static __inline void *ExchangePtr(XchgPtr *dest, void *newval) return ret; } -static __inline ALboolean CompExchangePtr(XchgPtr *dest, void *oldval, void *newval) +static inline ALboolean CompExchangePtr(XchgPtr *dest, void *oldval, void *newval) { void *ret; __asm__ __volatile__( @@ -238,14 +238,14 @@ static __inline ALboolean CompExchangePtr(XchgPtr *dest, void *oldval, void *new #elif defined(_WIN32) typedef LONG RefCount; -static __inline RefCount IncrementRef(volatile RefCount *ptr) +static inline RefCount IncrementRef(volatile RefCount *ptr) { return InterlockedIncrement(ptr); } -static __inline RefCount DecrementRef(volatile RefCount *ptr) +static inline RefCount DecrementRef(volatile RefCount *ptr) { return InterlockedDecrement(ptr); } extern ALbyte LONG_size_does_not_match_int[(sizeof(LONG)==sizeof(int))?1:-1]; -static __inline int ExchangeInt(volatile int *ptr, int newval) +static inline int ExchangeInt(volatile int *ptr, int newval) { union { volatile int *i; @@ -253,11 +253,11 @@ static __inline int ExchangeInt(volatile int *ptr, int newval) } u = { ptr }; return InterlockedExchange(u.l, newval); } -static __inline void *ExchangePtr(XchgPtr *ptr, void *newval) +static inline void *ExchangePtr(XchgPtr *ptr, void *newval) { return InterlockedExchangePointer(ptr, newval); } -static __inline ALboolean CompExchangeInt(volatile int *ptr, int oldval, int newval) +static inline ALboolean CompExchangeInt(volatile int *ptr, int oldval, int newval) { union { volatile int *i; @@ -265,7 +265,7 @@ static __inline ALboolean CompExchangeInt(volatile int *ptr, int oldval, int new } u = { ptr }; return InterlockedCompareExchange(u.l, newval, oldval) == oldval; } -static __inline ALboolean CompExchangePtr(XchgPtr *ptr, void *oldval, void *newval) +static inline ALboolean CompExchangePtr(XchgPtr *ptr, void *oldval, void *newval) { return InterlockedCompareExchangePointer(ptr, newval, oldval) == oldval; } @@ -275,12 +275,12 @@ static __inline ALboolean CompExchangePtr(XchgPtr *ptr, void *oldval, void *newv #include <libkern/OSAtomic.h> typedef int32_t RefCount; -static __inline RefCount IncrementRef(volatile RefCount *ptr) +static inline RefCount IncrementRef(volatile RefCount *ptr) { return OSAtomicIncrement32Barrier(ptr); } -static __inline RefCount DecrementRef(volatile RefCount *ptr) +static inline RefCount DecrementRef(volatile RefCount *ptr) { return OSAtomicDecrement32Barrier(ptr); } -static __inline int ExchangeInt(volatile int *ptr, int newval) +static inline int ExchangeInt(volatile int *ptr, int newval) { /* Really? No regular old atomic swap? */ int oldval; @@ -289,7 +289,7 @@ static __inline int ExchangeInt(volatile int *ptr, int newval) } while(!OSAtomicCompareAndSwap32Barrier(oldval, newval, ptr)); return oldval; } -static __inline void *ExchangePtr(XchgPtr *ptr, void *newval) +static inline void *ExchangePtr(XchgPtr *ptr, void *newval) { void *oldval; do { @@ -297,11 +297,11 @@ static __inline void *ExchangePtr(XchgPtr *ptr, void *newval) } while(!OSAtomicCompareAndSwapPtrBarrier(oldval, newval, ptr)); return oldval; } -static __inline ALboolean CompExchangeInt(volatile int *ptr, int oldval, int newval) +static inline ALboolean CompExchangeInt(volatile int *ptr, int oldval, int newval) { return OSAtomicCompareAndSwap32Barrier(oldval, newval, ptr); } -static __inline ALboolean CompExchangePtr(XchgPtr *ptr, void *oldval, void *newval) +static inline ALboolean CompExchangePtr(XchgPtr *ptr, void *oldval, void *newval) { return OSAtomicCompareAndSwapPtrBarrier(oldval, newval, ptr); } @@ -345,13 +345,13 @@ ALenum InsertUIntMapEntry(UIntMap *map, ALuint key, ALvoid *value); ALvoid *RemoveUIntMapKey(UIntMap *map, ALuint key); ALvoid *LookupUIntMapKey(UIntMap *map, ALuint key); -static __inline void LockUIntMapRead(UIntMap *map) +static inline void LockUIntMapRead(UIntMap *map) { ReadLock(&map->lock); } -static __inline void UnlockUIntMapRead(UIntMap *map) +static inline void UnlockUIntMapRead(UIntMap *map) { ReadUnlock(&map->lock); } -static __inline void LockUIntMapWrite(UIntMap *map) +static inline void LockUIntMapWrite(UIntMap *map) { WriteLock(&map->lock); } -static __inline void UnlockUIntMapWrite(UIntMap *map) +static inline void UnlockUIntMapWrite(UIntMap *map) { WriteUnlock(&map->lock); } @@ -367,7 +367,7 @@ struct Hrtf; // Find the next power-of-2 for non-power-of-2 numbers. -static __inline ALuint NextPowerOf2(ALuint value) +static inline ALuint NextPowerOf2(ALuint value) { if(value > 0) { @@ -383,7 +383,7 @@ static __inline ALuint NextPowerOf2(ALuint value) /* Fast float-to-int conversion. Assumes the FPU is already in round-to-zero * mode. */ -static __inline ALint fastf2i(ALfloat f) +static inline ALint fastf2i(ALfloat f) { #ifdef HAVE_LRINTF return lrintf(f); @@ -399,7 +399,7 @@ static __inline ALint fastf2i(ALfloat f) /* Fast float-to-uint conversion. Assumes the FPU is already in round-to-zero * mode. */ -static __inline ALuint fastf2u(ALfloat f) +static inline ALuint fastf2u(ALfloat f) { return fastf2i(f); } @@ -546,7 +546,7 @@ enum DevFmtChannels { ALuint BytesFromDevFmt(enum DevFmtType type); ALuint ChannelsFromDevFmt(enum DevFmtChannels chans); -static __inline ALuint FrameSizeFromDevFmt(enum DevFmtChannels chans, +static inline ALuint FrameSizeFromDevFmt(enum DevFmtChannels chans, enum DevFmtType type) { return ChannelsFromDevFmt(chans) * BytesFromDevFmt(type); @@ -751,9 +751,9 @@ void ALCdevice_LockDefault(ALCdevice *device); void ALCdevice_UnlockDefault(ALCdevice *device); ALint64 ALCdevice_GetLatencyDefault(ALCdevice *device); -static __inline void LockContext(ALCcontext *context) +static inline void LockContext(ALCcontext *context) { ALCdevice_Lock(context->Device); } -static __inline void UnlockContext(ALCcontext *context) +static inline void UnlockContext(ALCcontext *context) { ALCdevice_Unlock(context->Device); } diff --git a/OpenAL32/Include/alu.h b/OpenAL32/Include/alu.h index f323b0d0..b389ec1e 100644 --- a/OpenAL32/Include/alu.h +++ b/OpenAL32/Include/alu.h @@ -51,47 +51,47 @@ typedef ALvoid (*WetMixerFunc)(const struct SendParams *params, #define FRACTIONMASK (FRACTIONONE-1) -static __inline ALfloat minf(ALfloat a, ALfloat b) +static inline ALfloat minf(ALfloat a, ALfloat b) { return ((a > b) ? b : a); } -static __inline ALfloat maxf(ALfloat a, ALfloat b) +static inline ALfloat maxf(ALfloat a, ALfloat b) { return ((a > b) ? a : b); } -static __inline ALfloat clampf(ALfloat val, ALfloat min, ALfloat max) +static inline ALfloat clampf(ALfloat val, ALfloat min, ALfloat max) { return minf(max, maxf(min, val)); } -static __inline ALuint minu(ALuint a, ALuint b) +static inline ALuint minu(ALuint a, ALuint b) { return ((a > b) ? b : a); } -static __inline ALuint maxu(ALuint a, ALuint b) +static inline ALuint maxu(ALuint a, ALuint b) { return ((a > b) ? a : b); } -static __inline ALuint clampu(ALuint val, ALuint min, ALuint max) +static inline ALuint clampu(ALuint val, ALuint min, ALuint max) { return minu(max, maxu(min, val)); } -static __inline ALint mini(ALint a, ALint b) +static inline ALint mini(ALint a, ALint b) { return ((a > b) ? b : a); } -static __inline ALint maxi(ALint a, ALint b) +static inline ALint maxi(ALint a, ALint b) { return ((a > b) ? a : b); } -static __inline ALint clampi(ALint val, ALint min, ALint max) +static inline ALint clampi(ALint val, ALint min, ALint max) { return mini(max, maxi(min, val)); } -static __inline ALint64 mini64(ALint64 a, ALint64 b) +static inline ALint64 mini64(ALint64 a, ALint64 b) { return ((a > b) ? b : a); } -static __inline ALint64 maxi64(ALint64 a, ALint64 b) +static inline ALint64 maxi64(ALint64 a, ALint64 b) { return ((a > b) ? a : b); } -static __inline ALint64 clampi64(ALint64 val, ALint64 min, ALint64 max) +static inline ALint64 clampi64(ALint64 val, ALint64 min, ALint64 max) { return mini64(max, maxi64(min, val)); } -static __inline ALuint64 minu64(ALuint64 a, ALuint64 b) +static inline ALuint64 minu64(ALuint64 a, ALuint64 b) { return ((a > b) ? b : a); } -static __inline ALuint64 maxu64(ALuint64 a, ALuint64 b) +static inline ALuint64 maxu64(ALuint64 a, ALuint64 b) { return ((a > b) ? a : b); } -static __inline ALuint64 clampu64(ALuint64 val, ALuint64 min, ALuint64 max) +static inline ALuint64 clampu64(ALuint64 val, ALuint64 min, ALuint64 max) { return minu64(max, maxu64(min, val)); } -static __inline ALfloat lerp(ALfloat val1, ALfloat val2, ALfloat mu) +static inline ALfloat lerp(ALfloat val1, ALfloat val2, ALfloat mu) { return val1 + (val2-val1)*mu; } -static __inline ALfloat cubic(ALfloat val0, ALfloat val1, ALfloat val2, ALfloat val3, ALfloat mu) +static inline ALfloat cubic(ALfloat val0, ALfloat val1, ALfloat val2, ALfloat val3, ALfloat mu) { ALfloat mu2 = mu*mu; ALfloat a0 = -0.5f*val0 + 1.5f*val1 + -1.5f*val2 + 0.5f*val3; diff --git a/OpenAL32/alAuxEffectSlot.c b/OpenAL32/alAuxEffectSlot.c index 06eb6823..99cac58e 100644 --- a/OpenAL32/alAuxEffectSlot.c +++ b/OpenAL32/alAuxEffectSlot.c @@ -37,7 +37,7 @@ static ALvoid RemoveEffectSlotArray(ALCcontext *Context, ALeffectslot *slot); static UIntMap EffectStateFactoryMap; -static __inline ALeffectStateFactory *getFactoryByType(ALenum type) +static inline ALeffectStateFactory *getFactoryByType(ALenum type) { ALeffectStateFactory* (*getFactory)(void) = LookupUIntMapKey(&EffectStateFactoryMap, type); if(getFactory != NULL) diff --git a/OpenAL32/alBuffer.c b/OpenAL32/alBuffer.c index af6e1ffc..2daa2e3d 100644 --- a/OpenAL32/alBuffer.c +++ b/OpenAL32/alBuffer.c @@ -1030,7 +1030,7 @@ typedef struct { } ALubyte3; extern ALbyte ALubyte3_size_is_not_3[(sizeof(ALubyte3)==sizeof(ALubyte[3]))?1:-1]; -static __inline ALshort DecodeMuLaw(ALmulaw val) +static inline ALshort DecodeMuLaw(ALmulaw val) { return muLawDecompressionTable[val]; } static ALmulaw EncodeMuLaw(ALshort val) @@ -1055,7 +1055,7 @@ static ALmulaw EncodeMuLaw(ALshort val) return ~(sign | (exp<<4) | mant); } -static __inline ALshort DecodeALaw(ALalaw val) +static inline ALshort DecodeALaw(ALalaw val) { return aLawDecompressionTable[val]; } static ALalaw EncodeALaw(ALshort val) @@ -1202,14 +1202,14 @@ static void EncodeIMA4Block(ALima4 *dst, const ALshort *src, ALint *sample, ALin } -static __inline ALint DecodeByte3(ALbyte3 val) +static inline ALint DecodeByte3(ALbyte3 val) { if(IS_LITTLE_ENDIAN) return (val.b[2]<<16) | (((ALubyte)val.b[1])<<8) | ((ALubyte)val.b[0]); return (val.b[0]<<16) | (((ALubyte)val.b[1])<<8) | ((ALubyte)val.b[2]); } -static __inline ALbyte3 EncodeByte3(ALint val) +static inline ALbyte3 EncodeByte3(ALint val) { if(IS_LITTLE_ENDIAN) { @@ -1223,14 +1223,14 @@ static __inline ALbyte3 EncodeByte3(ALint val) } } -static __inline ALint DecodeUByte3(ALubyte3 val) +static inline ALint DecodeUByte3(ALubyte3 val) { if(IS_LITTLE_ENDIAN) return (val.b[2]<<16) | (val.b[1]<<8) | (val.b[0]); return (val.b[0]<<16) | (val.b[1]<<8) | val.b[2]; } -static __inline ALubyte3 EncodeUByte3(ALint val) +static inline ALubyte3 EncodeUByte3(ALint val) { if(IS_LITTLE_ENDIAN) { @@ -1245,256 +1245,256 @@ static __inline ALubyte3 EncodeUByte3(ALint val) } -static __inline ALbyte Conv_ALbyte_ALbyte(ALbyte val) +static inline ALbyte Conv_ALbyte_ALbyte(ALbyte val) { return val; } -static __inline ALbyte Conv_ALbyte_ALubyte(ALubyte val) +static inline ALbyte Conv_ALbyte_ALubyte(ALubyte val) { return val-128; } -static __inline ALbyte Conv_ALbyte_ALshort(ALshort val) +static inline ALbyte Conv_ALbyte_ALshort(ALshort val) { return val>>8; } -static __inline ALbyte Conv_ALbyte_ALushort(ALushort val) +static inline ALbyte Conv_ALbyte_ALushort(ALushort val) { return (val>>8)-128; } -static __inline ALbyte Conv_ALbyte_ALint(ALint val) +static inline ALbyte Conv_ALbyte_ALint(ALint val) { return val>>24; } -static __inline ALbyte Conv_ALbyte_ALuint(ALuint val) +static inline ALbyte Conv_ALbyte_ALuint(ALuint val) { return (val>>24)-128; } -static __inline ALbyte Conv_ALbyte_ALfloat(ALfloat val) +static inline ALbyte Conv_ALbyte_ALfloat(ALfloat val) { if(val > 1.0f) return 127; if(val < -1.0f) return -128; return (ALint)(val * 127.0f); } -static __inline ALbyte Conv_ALbyte_ALdouble(ALdouble val) +static inline ALbyte Conv_ALbyte_ALdouble(ALdouble val) { if(val > 1.0) return 127; if(val < -1.0) return -128; return (ALint)(val * 127.0); } -static __inline ALbyte Conv_ALbyte_ALmulaw(ALmulaw val) +static inline ALbyte Conv_ALbyte_ALmulaw(ALmulaw val) { return Conv_ALbyte_ALshort(DecodeMuLaw(val)); } -static __inline ALbyte Conv_ALbyte_ALalaw(ALalaw val) +static inline ALbyte Conv_ALbyte_ALalaw(ALalaw val) { return Conv_ALbyte_ALshort(DecodeALaw(val)); } -static __inline ALbyte Conv_ALbyte_ALbyte3(ALbyte3 val) +static inline ALbyte Conv_ALbyte_ALbyte3(ALbyte3 val) { return DecodeByte3(val)>>16; } -static __inline ALbyte Conv_ALbyte_ALubyte3(ALubyte3 val) +static inline ALbyte Conv_ALbyte_ALubyte3(ALubyte3 val) { return (DecodeUByte3(val)>>16)-128; } -static __inline ALubyte Conv_ALubyte_ALbyte(ALbyte val) +static inline ALubyte Conv_ALubyte_ALbyte(ALbyte val) { return val+128; } -static __inline ALubyte Conv_ALubyte_ALubyte(ALubyte val) +static inline ALubyte Conv_ALubyte_ALubyte(ALubyte val) { return val; } -static __inline ALubyte Conv_ALubyte_ALshort(ALshort val) +static inline ALubyte Conv_ALubyte_ALshort(ALshort val) { return (val>>8)+128; } -static __inline ALubyte Conv_ALubyte_ALushort(ALushort val) +static inline ALubyte Conv_ALubyte_ALushort(ALushort val) { return val>>8; } -static __inline ALubyte Conv_ALubyte_ALint(ALint val) +static inline ALubyte Conv_ALubyte_ALint(ALint val) { return (val>>24)+128; } -static __inline ALubyte Conv_ALubyte_ALuint(ALuint val) +static inline ALubyte Conv_ALubyte_ALuint(ALuint val) { return val>>24; } -static __inline ALubyte Conv_ALubyte_ALfloat(ALfloat val) +static inline ALubyte Conv_ALubyte_ALfloat(ALfloat val) { if(val > 1.0f) return 255; if(val < -1.0f) return 0; return (ALint)(val * 127.0f) + 128; } -static __inline ALubyte Conv_ALubyte_ALdouble(ALdouble val) +static inline ALubyte Conv_ALubyte_ALdouble(ALdouble val) { if(val > 1.0) return 255; if(val < -1.0) return 0; return (ALint)(val * 127.0) + 128; } -static __inline ALubyte Conv_ALubyte_ALmulaw(ALmulaw val) +static inline ALubyte Conv_ALubyte_ALmulaw(ALmulaw val) { return Conv_ALubyte_ALshort(DecodeMuLaw(val)); } -static __inline ALubyte Conv_ALubyte_ALalaw(ALalaw val) +static inline ALubyte Conv_ALubyte_ALalaw(ALalaw val) { return Conv_ALubyte_ALshort(DecodeALaw(val)); } -static __inline ALubyte Conv_ALubyte_ALbyte3(ALbyte3 val) +static inline ALubyte Conv_ALubyte_ALbyte3(ALbyte3 val) { return (DecodeByte3(val)>>16)+128; } -static __inline ALubyte Conv_ALubyte_ALubyte3(ALubyte3 val) +static inline ALubyte Conv_ALubyte_ALubyte3(ALubyte3 val) { return DecodeUByte3(val)>>16; } -static __inline ALshort Conv_ALshort_ALbyte(ALbyte val) +static inline ALshort Conv_ALshort_ALbyte(ALbyte val) { return val<<8; } -static __inline ALshort Conv_ALshort_ALubyte(ALubyte val) +static inline ALshort Conv_ALshort_ALubyte(ALubyte val) { return (val-128)<<8; } -static __inline ALshort Conv_ALshort_ALshort(ALshort val) +static inline ALshort Conv_ALshort_ALshort(ALshort val) { return val; } -static __inline ALshort Conv_ALshort_ALushort(ALushort val) +static inline ALshort Conv_ALshort_ALushort(ALushort val) { return val-32768; } -static __inline ALshort Conv_ALshort_ALint(ALint val) +static inline ALshort Conv_ALshort_ALint(ALint val) { return val>>16; } -static __inline ALshort Conv_ALshort_ALuint(ALuint val) +static inline ALshort Conv_ALshort_ALuint(ALuint val) { return (val>>16)-32768; } -static __inline ALshort Conv_ALshort_ALfloat(ALfloat val) +static inline ALshort Conv_ALshort_ALfloat(ALfloat val) { if(val > 1.0f) return 32767; if(val < -1.0f) return -32768; return (ALint)(val * 32767.0f); } -static __inline ALshort Conv_ALshort_ALdouble(ALdouble val) +static inline ALshort Conv_ALshort_ALdouble(ALdouble val) { if(val > 1.0) return 32767; if(val < -1.0) return -32768; return (ALint)(val * 32767.0); } -static __inline ALshort Conv_ALshort_ALmulaw(ALmulaw val) +static inline ALshort Conv_ALshort_ALmulaw(ALmulaw val) { return Conv_ALshort_ALshort(DecodeMuLaw(val)); } -static __inline ALshort Conv_ALshort_ALalaw(ALalaw val) +static inline ALshort Conv_ALshort_ALalaw(ALalaw val) { return Conv_ALshort_ALshort(DecodeALaw(val)); } -static __inline ALshort Conv_ALshort_ALbyte3(ALbyte3 val) +static inline ALshort Conv_ALshort_ALbyte3(ALbyte3 val) { return DecodeByte3(val)>>8; } -static __inline ALshort Conv_ALshort_ALubyte3(ALubyte3 val) +static inline ALshort Conv_ALshort_ALubyte3(ALubyte3 val) { return (DecodeUByte3(val)>>8)-32768; } -static __inline ALushort Conv_ALushort_ALbyte(ALbyte val) +static inline ALushort Conv_ALushort_ALbyte(ALbyte val) { return (val+128)<<8; } -static __inline ALushort Conv_ALushort_ALubyte(ALubyte val) +static inline ALushort Conv_ALushort_ALubyte(ALubyte val) { return val<<8; } -static __inline ALushort Conv_ALushort_ALshort(ALshort val) +static inline ALushort Conv_ALushort_ALshort(ALshort val) { return val+32768; } -static __inline ALushort Conv_ALushort_ALushort(ALushort val) +static inline ALushort Conv_ALushort_ALushort(ALushort val) { return val; } -static __inline ALushort Conv_ALushort_ALint(ALint val) +static inline ALushort Conv_ALushort_ALint(ALint val) { return (val>>16)+32768; } -static __inline ALushort Conv_ALushort_ALuint(ALuint val) +static inline ALushort Conv_ALushort_ALuint(ALuint val) { return val>>16; } -static __inline ALushort Conv_ALushort_ALfloat(ALfloat val) +static inline ALushort Conv_ALushort_ALfloat(ALfloat val) { if(val > 1.0f) return 65535; if(val < -1.0f) return 0; return (ALint)(val * 32767.0f) + 32768; } -static __inline ALushort Conv_ALushort_ALdouble(ALdouble val) +static inline ALushort Conv_ALushort_ALdouble(ALdouble val) { if(val > 1.0) return 65535; if(val < -1.0) return 0; return (ALint)(val * 32767.0) + 32768; } -static __inline ALushort Conv_ALushort_ALmulaw(ALmulaw val) +static inline ALushort Conv_ALushort_ALmulaw(ALmulaw val) { return Conv_ALushort_ALshort(DecodeMuLaw(val)); } -static __inline ALushort Conv_ALushort_ALalaw(ALalaw val) +static inline ALushort Conv_ALushort_ALalaw(ALalaw val) { return Conv_ALushort_ALshort(DecodeALaw(val)); } -static __inline ALushort Conv_ALushort_ALbyte3(ALbyte3 val) +static inline ALushort Conv_ALushort_ALbyte3(ALbyte3 val) { return (DecodeByte3(val)>>8)+32768; } -static __inline ALushort Conv_ALushort_ALubyte3(ALubyte3 val) +static inline ALushort Conv_ALushort_ALubyte3(ALubyte3 val) { return DecodeUByte3(val)>>8; } -static __inline ALint Conv_ALint_ALbyte(ALbyte val) +static inline ALint Conv_ALint_ALbyte(ALbyte val) { return val<<24; } -static __inline ALint Conv_ALint_ALubyte(ALubyte val) +static inline ALint Conv_ALint_ALubyte(ALubyte val) { return (val-128)<<24; } -static __inline ALint Conv_ALint_ALshort(ALshort val) +static inline ALint Conv_ALint_ALshort(ALshort val) { return val<<16; } -static __inline ALint Conv_ALint_ALushort(ALushort val) +static inline ALint Conv_ALint_ALushort(ALushort val) { return (val-32768)<<16; } -static __inline ALint Conv_ALint_ALint(ALint val) +static inline ALint Conv_ALint_ALint(ALint val) { return val; } -static __inline ALint Conv_ALint_ALuint(ALuint val) +static inline ALint Conv_ALint_ALuint(ALuint val) { return val-2147483648u; } -static __inline ALint Conv_ALint_ALfloat(ALfloat val) +static inline ALint Conv_ALint_ALfloat(ALfloat val) { if(val > 1.0f) return 2147483647; if(val < -1.0f) return -2147483647-1; return (ALint)(val*16777215.0f) << 7; } -static __inline ALint Conv_ALint_ALdouble(ALdouble val) +static inline ALint Conv_ALint_ALdouble(ALdouble val) { if(val > 1.0) return 2147483647; if(val < -1.0) return -2147483647-1; return (ALint)(val * 2147483647.0); } -static __inline ALint Conv_ALint_ALmulaw(ALmulaw val) +static inline ALint Conv_ALint_ALmulaw(ALmulaw val) { return Conv_ALint_ALshort(DecodeMuLaw(val)); } -static __inline ALint Conv_ALint_ALalaw(ALalaw val) +static inline ALint Conv_ALint_ALalaw(ALalaw val) { return Conv_ALint_ALshort(DecodeALaw(val)); } -static __inline ALint Conv_ALint_ALbyte3(ALbyte3 val) +static inline ALint Conv_ALint_ALbyte3(ALbyte3 val) { return DecodeByte3(val)<<8; } -static __inline ALint Conv_ALint_ALubyte3(ALubyte3 val) +static inline ALint Conv_ALint_ALubyte3(ALubyte3 val) { return (DecodeUByte3(val)-8388608)<<8; } -static __inline ALuint Conv_ALuint_ALbyte(ALbyte val) +static inline ALuint Conv_ALuint_ALbyte(ALbyte val) { return (val+128)<<24; } -static __inline ALuint Conv_ALuint_ALubyte(ALubyte val) +static inline ALuint Conv_ALuint_ALubyte(ALubyte val) { return val<<24; } -static __inline ALuint Conv_ALuint_ALshort(ALshort val) +static inline ALuint Conv_ALuint_ALshort(ALshort val) { return (val+32768)<<16; } -static __inline ALuint Conv_ALuint_ALushort(ALushort val) +static inline ALuint Conv_ALuint_ALushort(ALushort val) { return val<<16; } -static __inline ALuint Conv_ALuint_ALint(ALint val) +static inline ALuint Conv_ALuint_ALint(ALint val) { return val+2147483648u; } -static __inline ALuint Conv_ALuint_ALuint(ALuint val) +static inline ALuint Conv_ALuint_ALuint(ALuint val) { return val; } -static __inline ALuint Conv_ALuint_ALfloat(ALfloat val) +static inline ALuint Conv_ALuint_ALfloat(ALfloat val) { if(val > 1.0f) return 4294967295u; if(val < -1.0f) return 0; return ((ALint)(val*16777215.0f)<<7) + 2147483648u; } -static __inline ALuint Conv_ALuint_ALdouble(ALdouble val) +static inline ALuint Conv_ALuint_ALdouble(ALdouble val) { if(val > 1.0) return 4294967295u; if(val < -1.0) return 0; return (ALint)(val * 2147483647.0) + 2147483648u; } -static __inline ALuint Conv_ALuint_ALmulaw(ALmulaw val) +static inline ALuint Conv_ALuint_ALmulaw(ALmulaw val) { return Conv_ALuint_ALshort(DecodeMuLaw(val)); } -static __inline ALuint Conv_ALuint_ALalaw(ALalaw val) +static inline ALuint Conv_ALuint_ALalaw(ALalaw val) { return Conv_ALuint_ALshort(DecodeALaw(val)); } -static __inline ALuint Conv_ALuint_ALbyte3(ALbyte3 val) +static inline ALuint Conv_ALuint_ALbyte3(ALbyte3 val) { return (DecodeByte3(val)+8388608)<<8; } -static __inline ALuint Conv_ALuint_ALubyte3(ALubyte3 val) +static inline ALuint Conv_ALuint_ALubyte3(ALubyte3 val) { return DecodeUByte3(val)<<8; } -static __inline ALfloat Conv_ALfloat_ALbyte(ALbyte val) +static inline ALfloat Conv_ALfloat_ALbyte(ALbyte val) { return val * (1.0f/127.0f); } -static __inline ALfloat Conv_ALfloat_ALubyte(ALubyte val) +static inline ALfloat Conv_ALfloat_ALubyte(ALubyte val) { return (val-128) * (1.0f/127.0f); } -static __inline ALfloat Conv_ALfloat_ALshort(ALshort val) +static inline ALfloat Conv_ALfloat_ALshort(ALshort val) { return val * (1.0f/32767.0f); } -static __inline ALfloat Conv_ALfloat_ALushort(ALushort val) +static inline ALfloat Conv_ALfloat_ALushort(ALushort val) { return (val-32768) * (1.0f/32767.0f); } -static __inline ALfloat Conv_ALfloat_ALint(ALint val) +static inline ALfloat Conv_ALfloat_ALint(ALint val) { return (ALfloat)(val * (1.0/2147483647.0)); } -static __inline ALfloat Conv_ALfloat_ALuint(ALuint val) +static inline ALfloat Conv_ALfloat_ALuint(ALuint val) { return (ALfloat)((ALint)(val-2147483648u) * (1.0/2147483647.0)); } -static __inline ALfloat Conv_ALfloat_ALfloat(ALfloat val) +static inline ALfloat Conv_ALfloat_ALfloat(ALfloat val) { return (val==val) ? val : 0.0f; } -static __inline ALfloat Conv_ALfloat_ALdouble(ALdouble val) +static inline ALfloat Conv_ALfloat_ALdouble(ALdouble val) { return (val==val) ? (ALfloat)val : 0.0f; } -static __inline ALfloat Conv_ALfloat_ALmulaw(ALmulaw val) +static inline ALfloat Conv_ALfloat_ALmulaw(ALmulaw val) { return Conv_ALfloat_ALshort(DecodeMuLaw(val)); } -static __inline ALfloat Conv_ALfloat_ALalaw(ALalaw val) +static inline ALfloat Conv_ALfloat_ALalaw(ALalaw val) { return Conv_ALfloat_ALshort(DecodeALaw(val)); } -static __inline ALfloat Conv_ALfloat_ALbyte3(ALbyte3 val) +static inline ALfloat Conv_ALfloat_ALbyte3(ALbyte3 val) { return (ALfloat)(DecodeByte3(val) * (1.0/8388607.0)); } -static __inline ALfloat Conv_ALfloat_ALubyte3(ALubyte3 val) +static inline ALfloat Conv_ALfloat_ALubyte3(ALubyte3 val) { return (ALfloat)((DecodeUByte3(val)-8388608) * (1.0/8388607.0)); } -static __inline ALdouble Conv_ALdouble_ALbyte(ALbyte val) +static inline ALdouble Conv_ALdouble_ALbyte(ALbyte val) { return val * (1.0/127.0); } -static __inline ALdouble Conv_ALdouble_ALubyte(ALubyte val) +static inline ALdouble Conv_ALdouble_ALubyte(ALubyte val) { return (val-128) * (1.0/127.0); } -static __inline ALdouble Conv_ALdouble_ALshort(ALshort val) +static inline ALdouble Conv_ALdouble_ALshort(ALshort val) { return val * (1.0/32767.0); } -static __inline ALdouble Conv_ALdouble_ALushort(ALushort val) +static inline ALdouble Conv_ALdouble_ALushort(ALushort val) { return (val-32768) * (1.0/32767.0); } -static __inline ALdouble Conv_ALdouble_ALint(ALint val) +static inline ALdouble Conv_ALdouble_ALint(ALint val) { return val * (1.0/2147483647.0); } -static __inline ALdouble Conv_ALdouble_ALuint(ALuint val) +static inline ALdouble Conv_ALdouble_ALuint(ALuint val) { return (ALint)(val-2147483648u) * (1.0/2147483647.0); } -static __inline ALdouble Conv_ALdouble_ALfloat(ALfloat val) +static inline ALdouble Conv_ALdouble_ALfloat(ALfloat val) { return (val==val) ? val : 0.0f; } -static __inline ALdouble Conv_ALdouble_ALdouble(ALdouble val) +static inline ALdouble Conv_ALdouble_ALdouble(ALdouble val) { return (val==val) ? val : 0.0; } -static __inline ALdouble Conv_ALdouble_ALmulaw(ALmulaw val) +static inline ALdouble Conv_ALdouble_ALmulaw(ALmulaw val) { return Conv_ALdouble_ALshort(DecodeMuLaw(val)); } -static __inline ALdouble Conv_ALdouble_ALalaw(ALalaw val) +static inline ALdouble Conv_ALdouble_ALalaw(ALalaw val) { return Conv_ALdouble_ALshort(DecodeALaw(val)); } -static __inline ALdouble Conv_ALdouble_ALbyte3(ALbyte3 val) +static inline ALdouble Conv_ALdouble_ALbyte3(ALbyte3 val) { return DecodeByte3(val) * (1.0/8388607.0); } -static __inline ALdouble Conv_ALdouble_ALubyte3(ALubyte3 val) +static inline ALdouble Conv_ALdouble_ALubyte3(ALubyte3 val) { return (DecodeUByte3(val)-8388608) * (1.0/8388607.0); } #define DECL_TEMPLATE(T) \ -static __inline ALmulaw Conv_ALmulaw_##T(T val) \ +static inline ALmulaw Conv_ALmulaw_##T(T val) \ { return EncodeMuLaw(Conv_ALshort_##T(val)); } DECL_TEMPLATE(ALbyte) @@ -1505,7 +1505,7 @@ DECL_TEMPLATE(ALint) DECL_TEMPLATE(ALuint) DECL_TEMPLATE(ALfloat) DECL_TEMPLATE(ALdouble) -static __inline ALmulaw Conv_ALmulaw_ALmulaw(ALmulaw val) +static inline ALmulaw Conv_ALmulaw_ALmulaw(ALmulaw val) { return val; } DECL_TEMPLATE(ALalaw) DECL_TEMPLATE(ALbyte3) @@ -1514,7 +1514,7 @@ DECL_TEMPLATE(ALubyte3) #undef DECL_TEMPLATE #define DECL_TEMPLATE(T) \ -static __inline ALalaw Conv_ALalaw_##T(T val) \ +static inline ALalaw Conv_ALalaw_##T(T val) \ { return EncodeALaw(Conv_ALshort_##T(val)); } DECL_TEMPLATE(ALbyte) @@ -1526,7 +1526,7 @@ DECL_TEMPLATE(ALuint) DECL_TEMPLATE(ALfloat) DECL_TEMPLATE(ALdouble) DECL_TEMPLATE(ALmulaw) -static __inline ALalaw Conv_ALalaw_ALalaw(ALalaw val) +static inline ALalaw Conv_ALalaw_ALalaw(ALalaw val) { return val; } DECL_TEMPLATE(ALbyte3) DECL_TEMPLATE(ALubyte3) @@ -1534,7 +1534,7 @@ DECL_TEMPLATE(ALubyte3) #undef DECL_TEMPLATE #define DECL_TEMPLATE(T) \ -static __inline ALbyte3 Conv_ALbyte3_##T(T val) \ +static inline ALbyte3 Conv_ALbyte3_##T(T val) \ { return EncodeByte3(Conv_ALint_##T(val)>>8); } DECL_TEMPLATE(ALbyte) @@ -1547,14 +1547,14 @@ DECL_TEMPLATE(ALfloat) DECL_TEMPLATE(ALdouble) DECL_TEMPLATE(ALmulaw) DECL_TEMPLATE(ALalaw) -static __inline ALbyte3 Conv_ALbyte3_ALbyte3(ALbyte3 val) +static inline ALbyte3 Conv_ALbyte3_ALbyte3(ALbyte3 val) { return val; } DECL_TEMPLATE(ALubyte3) #undef DECL_TEMPLATE #define DECL_TEMPLATE(T) \ -static __inline ALubyte3 Conv_ALubyte3_##T(T val) \ +static inline ALubyte3 Conv_ALubyte3_##T(T val) \ { return EncodeUByte3(Conv_ALuint_##T(val)>>8); } DECL_TEMPLATE(ALbyte) @@ -1568,7 +1568,7 @@ DECL_TEMPLATE(ALdouble) DECL_TEMPLATE(ALmulaw) DECL_TEMPLATE(ALalaw) DECL_TEMPLATE(ALbyte3) -static __inline ALubyte3 Conv_ALubyte3_ALubyte3(ALubyte3 val) +static inline ALubyte3 Conv_ALubyte3_ALubyte3(ALubyte3 val) { return val; } #undef DECL_TEMPLATE |