From 5ed9f02c4de0a8ddb7649e0541a8d6f32f61b3f8 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 30 Jan 2013 22:53:12 +0100 Subject: TagPool, ...: include cleanup --- src/pcm_utils.h | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'src/pcm_utils.h') diff --git a/src/pcm_utils.h b/src/pcm_utils.h index 4ad896570..21df95e48 100644 --- a/src/pcm_utils.h +++ b/src/pcm_utils.h @@ -20,7 +20,7 @@ #ifndef MPD_PCM_UTILS_H #define MPD_PCM_UTILS_H -#include +#include "gcc.h" #include @@ -42,9 +42,9 @@ pcm_end_pointer(const void *p, size_t size) static inline int32_t pcm_range(int32_t sample, unsigned bits) { - if (G_UNLIKELY(sample < (-1 << (bits - 1)))) + if (gcc_unlikely(sample < (-1 << (bits - 1)))) return -1 << (bits - 1); - if (G_UNLIKELY(sample >= (1 << (bits - 1)))) + if (gcc_unlikely(sample >= (1 << (bits - 1)))) return (1 << (bits - 1)) - 1; return sample; } @@ -56,37 +56,37 @@ pcm_range(int32_t sample, unsigned bits) static inline int64_t pcm_range_64(int64_t sample, unsigned bits) { - if (G_UNLIKELY(sample < ((int64_t)-1 << (bits - 1)))) + if (gcc_unlikely(sample < ((int64_t)-1 << (bits - 1)))) return (int64_t)-1 << (bits - 1); - if (G_UNLIKELY(sample >= ((int64_t)1 << (bits - 1)))) + if (gcc_unlikely(sample >= ((int64_t)1 << (bits - 1)))) return ((int64_t)1 << (bits - 1)) - 1; return sample; } -G_GNUC_CONST +gcc_const static inline int16_t pcm_clamp_16(int x) { - static const int32_t MIN_VALUE = G_MININT16; - static const int32_t MAX_VALUE = G_MAXINT16; + static const int32_t MIN_VALUE = -(1 << 15); + static const int32_t MAX_VALUE = (1 << 15) - 1; - if (G_UNLIKELY(x < MIN_VALUE)) + if (gcc_unlikely(x < MIN_VALUE)) return MIN_VALUE; - if (G_UNLIKELY(x > MAX_VALUE)) + if (gcc_unlikely(x > MAX_VALUE)) return MAX_VALUE; return x; } -G_GNUC_CONST +gcc_const static inline int32_t pcm_clamp_24(int x) { static const int32_t MIN_VALUE = -(1 << 23); static const int32_t MAX_VALUE = (1 << 23) - 1; - if (G_UNLIKELY(x < MIN_VALUE)) + if (gcc_unlikely(x < MIN_VALUE)) return MIN_VALUE; - if (G_UNLIKELY(x > MAX_VALUE)) + if (gcc_unlikely(x > MAX_VALUE)) return MAX_VALUE; return x; } -- cgit v1.2.3