Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1436)

Unified Diff: webrtc/modules/audio_coding/neteq/dtmf_tone_generator.cc

Issue 2430393003: Eliminate left shift of negative value by using multiplication instead (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/audio_coding/neteq/dtmf_tone_generator.cc
diff --git a/webrtc/modules/audio_coding/neteq/dtmf_tone_generator.cc b/webrtc/modules/audio_coding/neteq/dtmf_tone_generator.cc
index 8b4b9d3f4f661d8422ebba9e706fc9de1fe93c77..9dad2e5efd878c0242cd5f164762f6b5a4e39c73 100644
--- a/webrtc/modules/audio_coding/neteq/dtmf_tone_generator.cc
+++ b/webrtc/modules/audio_coding/neteq/dtmf_tone_generator.cc
@@ -195,7 +195,8 @@ int DtmfToneGenerator::Generate(size_t num_samples,
sample_history2_[1] = temp_val_high;
// Attenuate the low frequency tone 3 dB.
- int32_t temp_val = kAmpMultiplier * temp_val_low + (temp_val_high << 15);
+ int32_t temp_val =
+ kAmpMultiplier * temp_val_low + temp_val_high * (1 << 15);
// Normalize the signal to Q14 with proper rounding.
temp_val = (temp_val + 16384) >> 15;
// Scale the signal to correct volume.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698