aboutsummaryrefslogtreecommitdiffstats
path: root/src/pcm_utils.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/pcm_utils.h')
-rw-r--r--src/pcm_utils.h26
1 files changed, 13 insertions, 13 deletions
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 <glib.h>
+#include "gcc.h"
#include <stdint.h>
@@ -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;
}