From: Abramo Bagnara Date: Tue, 9 Jul 2002 20:21:00 +0000 (+0000) Subject: Fixed normalization X-Git-Tag: v1.0.3~403 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=a81bf16bc9363c742ed76e6bc9d77f86d19149ab;p=alsa-lib.git Fixed normalization --- diff --git a/src/pcm/plugin_ops.h b/src/pcm/plugin_ops.h index 8c5c2b22..9986d063 100644 --- a/src/pcm/plugin_ops.h +++ b/src/pcm/plugin_ops.h @@ -789,14 +789,14 @@ static inline void _norms(const void *src, void *dst, int32_t s; switch (src_wid) { case 8: - s = *(int8_t*)src; + s = *(int32_t*)src; if (s >= 0x7f) goto _max; else if (s <= -0x80) goto _min; break; case 16: - s = *(int16_t*)src; + s = *(int32_t*)src; if (s >= 0x7fff) goto _max; else if (s <= -0x8000) @@ -829,7 +829,7 @@ static inline void _norms(const void *src, void *dst, s *= 1 << bits; } else if (src_wid > dst_wid) { unsigned int bits = src_wid - dst_wid; - s = (s + (1 << (bits - 1)))/ (1 << bits); + s = (s + (1 << (bits - 1))) / (1 << bits); } if (!dst_sign) s += (1U << (dst_wid - 1));