diff options
author | 2018-11-07 21:22:34 +0000 | |
---|---|---|
committer | 2018-11-07 21:22:34 +0000 | |
commit | 22359d6584f7f12045dcbcf90e3e58a5a98f024b (patch) | |
tree | d24c9311ec5047675a040855f5902a07ab1d6043 | |
parent | Add a self test for each SSL library by connecting client with (diff) | |
download | wireguard-openbsd-22359d6584f7f12045dcbcf90e3e58a5a98f024b.tar.xz wireguard-openbsd-22359d6584f7f12045dcbcf90e3e58a5a98f024b.zip |
Fix clipping during float to integer conversions.
From Jari Vetoniemi <mailroxas at gmail.com>. Thanks!
-rw-r--r-- | usr.bin/aucat/dsp.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.bin/aucat/dsp.c b/usr.bin/aucat/dsp.c index c231fc2f7db..0ca1f6e20d3 100644 --- a/usr.bin/aucat/dsp.c +++ b/usr.bin/aucat/dsp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dsp.c,v 1.12 2018/09/18 04:29:58 miko Exp $ */ +/* $OpenBSD: dsp.c,v 1.13 2018/11/07 21:22:34 ratchov Exp $ */ /* * Copyright (c) 2008-2012 Alexandre Ratchov <alex@caoua.org> * @@ -660,11 +660,11 @@ f32_to_adata(unsigned int x) * 31 - (BITS - 1) - (e - 127) * * to ensure output is in the 0..(2^BITS)-1 range, the minimum - * shift is 31 - (BITS - 1), and maximum shift is 31 + * shift is 31 - (BITS - 1) + 1, and maximum shift is 31 */ if (e < 127 - (ADATA_BITS - 1)) y = 0; - else if (e > 127) + else if (e >= 127) y = ADATA_UNIT - 1; else y = m >> (127 + (32 - ADATA_BITS) - e); |