diff --git a/audio/utils.c b/audio/utils.c index db58642268..4d7b202592 100644 --- a/audio/utils.c +++ b/audio/utils.c @@ -15,9 +15,9 @@ #include "utils.h" -#if __SSE2__ +#if defined(__SSE2__) #include -#elif __ALTIVEC__ +#elif defined(__ALTIVEC__) #include #endif @@ -39,7 +39,7 @@ void audio_convert_float_to_s16_C(int16_t *out, } } -#if __SSE2__ +#if defined(__SSE2__) void audio_convert_s16_to_float_SSE2(float *out, const int16_t *in, size_t samples, float gain) { @@ -84,7 +84,7 @@ void audio_convert_float_to_s16_SSE2(int16_t *out, audio_convert_float_to_s16_C(out, in, samples - i); } -#elif __ALTIVEC__ +#elif defined(__ALTIVEC__) void audio_convert_s16_to_float_altivec(float *out, const int16_t *in, size_t samples, float gain) { @@ -133,14 +133,14 @@ void audio_convert_float_to_s16_altivec(int16_t *out, else audio_convert_float_to_s16_C(out, in, samples); } -#elif HAVE_NEON +#elif defined(HAVE_NEON) void audio_convert_s16_float_asm(float *out, const int16_t *in, size_t samples); void audio_convert_s16_to_float_neon(float *out, const int16_t *in, size_t samples, float gain) { (void)gain; // gain is ignored for now. - size_t aligned_samples = samples & 7; + size_t aligned_samples = samples & ~7; audio_convert_s16_float_asm(out, in, aligned_samples); // Could do all conversion in ASM, but keep it simple for now. @@ -151,7 +151,7 @@ void audio_convert_s16_to_float_neon(float *out, const int16_t *in, size_t sampl void audio_convert_float_s16_asm(int16_t *out, const float *in, size_t samples); void audio_convert_float_to_s16_neon(int16_t *out, const float *in, size_t samples) { - size_t aligned_samples = samples & 7; + size_t aligned_samples = samples & ~7; audio_convert_float_s16_asm(out, in, aligned_samples); audio_convert_float_to_s16_C(out + aligned_samples, in + aligned_samples, samples - aligned_samples); diff --git a/audio/utils.h b/audio/utils.h index ac7ca65caf..6b5d356926 100644 --- a/audio/utils.h +++ b/audio/utils.h @@ -19,7 +19,7 @@ #include #include -#if __SSE2__ +#if defined(__SSE2__) #define audio_convert_s16_to_float audio_convert_s16_to_float_SSE2 #define audio_convert_float_to_s16 audio_convert_float_to_s16_SSE2 @@ -29,7 +29,7 @@ void audio_convert_s16_to_float_SSE2(float *out, void audio_convert_float_to_s16_SSE2(int16_t *out, const float *in, size_t samples); -#elif __ALTIVEC__ +#elif defined(__ALTIVEC__) #define audio_convert_s16_to_float audio_convert_s16_to_float_altivec #define audio_convert_float_to_s16 audio_convert_float_to_s16_altivec