aboutsummaryrefslogtreecommitdiff
path: root/common_audio
diff options
context:
space:
mode:
authorAlex Loiko <aleloi@webrtc.org>2018-01-12 13:48:06 +0100
committerCommit Bot <commit-bot@chromium.org>2018-01-12 15:29:59 +0000
commitee67ca3fd8acbee79709b7ae2ec2de1af2cf577f (patch)
treee768902301d8bfb203fd640ee2ca81b83bf3af71 /common_audio
parentd84b3d1f3d8ad6b1e1f2667e2d2d48cf5ca59227 (diff)
downloadwebrtc-ee67ca3fd8acbee79709b7ae2ec2de1af2cf577f.tar.gz
Replace left shift with equivalent multiplication.
We have done changes to the Audio Processing fuzzer here https://webrtc-review.googlesource.com/c/src/+/36500/6. We ran the new version of the fuzzer locally. The UBSAN detector found these (minor) issues. We have used the Godbolt compiler explorer to check that similar changes produce identical compiled code. Bug: webrtc:7820 Change-Id: I9cc3b81e4be7cf691f878c37010ce105bc2f3e38 Reviewed-on: https://webrtc-review.googlesource.com/39264 Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Commit-Queue: Alex Loiko <aleloi@webrtc.org> Cr-Commit-Position: refs/heads/master@{#21605}
Diffstat (limited to 'common_audio')
-rw-r--r--common_audio/signal_processing/complex_fft.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/common_audio/signal_processing/complex_fft.c b/common_audio/signal_processing/complex_fft.c
index d4666f3598..36689b3c46 100644
--- a/common_audio/signal_processing/complex_fft.c
+++ b/common_audio/signal_processing/complex_fft.c
@@ -134,8 +134,8 @@ int WebRtcSpl_ComplexFFT(int16_t frfi[], int stages, int mode)
tr32 >>= 15 - CFFTSFT;
ti32 >>= 15 - CFFTSFT;
- qr32 = ((int32_t)frfi[2 * i]) << CFFTSFT;
- qi32 = ((int32_t)frfi[2 * i + 1]) << CFFTSFT;
+ qr32 = ((int32_t)frfi[2 * i]) * (1 << CFFTSFT);
+ qi32 = ((int32_t)frfi[2 * i + 1]) * (1 << CFFTSFT);
frfi[2 * j] = (int16_t)(
(qr32 - tr32 + CFFTRND2) >> (1 + CFFTSFT));
@@ -276,8 +276,8 @@ int WebRtcSpl_ComplexIFFT(int16_t frfi[], int stages, int mode)
tr32 >>= 15 - CIFFTSFT;
ti32 >>= 15 - CIFFTSFT;
- qr32 = ((int32_t)frfi[2 * i]) << CIFFTSFT;
- qi32 = ((int32_t)frfi[2 * i + 1]) << CIFFTSFT;
+ qr32 = ((int32_t)frfi[2 * i]) * (1 << CIFFTSFT);
+ qi32 = ((int32_t)frfi[2 * i + 1]) * (1 << CIFFTSFT);
frfi[2 * j] = (int16_t)(
(qr32 - tr32 + round2) >> (shift + CIFFTSFT));