diff options
Diffstat (limited to 'audio')
-rw-r--r-- | audio/mixeng.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/audio/mixeng.c b/audio/mixeng.c index 739a500449..924dcb858a 100644 --- a/audio/mixeng.c +++ b/audio/mixeng.c @@ -271,11 +271,12 @@ f_sample *mixeng_clip[2][2][2][3] = { #define CONV_NATURAL_FLOAT(x) (x) #define CLIP_NATURAL_FLOAT(x) (x) #else -static const float float_scale = UINT_MAX / 2.f; +/* macros to map [-1.f, 1.f] <-> [INT32_MIN, INT32_MAX + 1] */ +static const float float_scale = (int64_t)INT32_MAX + 1; #define CONV_NATURAL_FLOAT(x) ((x) * float_scale) #ifdef RECIPROCAL -static const float float_scale_reciprocal = 2.f / UINT_MAX; +static const float float_scale_reciprocal = 1.f / ((int64_t)INT32_MAX + 1); #define CLIP_NATURAL_FLOAT(x) ((x) * float_scale_reciprocal) #else #define CLIP_NATURAL_FLOAT(x) ((x) / float_scale) |