Fix C4434 warning about 32-bit shift assigned to 64-bits
VS 2015 has a new or louder warning about 32-bit shifts that are then assigned to a 64-bit target. This type of code triggers it: int64_t size = 1 << shift_amount; Because the '1' being shifted is a 32-bit int the result of the shift will be a 32-bit result, so assigning it to a 64-bit variable is just misleading. In this case the code that triggers it is this: size_t window_size = static_cast<size_t>(1 << shift_amount); The destination is a size_t so the warning only shows up on 64-bit builds and doesn't indicate a real bug. It's curious that the code had a cast already - presumably to suppress some other warning - but the cast is not in the ideal place and doesn't avoid this new warning. Moving the cast allows shift_amount to be log2(size_t) and allows enabling C4334 in Chromium. BUG=593448 Review URL: https://codereview.webrtc.org/1849753004 Cr-Commit-Position: refs/heads/master@{#12199}
This commit is contained in:
parent
fa0befe13b
commit
d81dc49c5b
@ -93,7 +93,7 @@ IntelligibilityEnhancer::IntelligibilityEnhancer(int sample_rate_hz,
|
||||
43.f));
|
||||
start_freq_ = std::max(static_cast<size_t>(1), erb_index * kErbResolution);
|
||||
|
||||
size_t window_size = static_cast<size_t>(1 << RealFourier::FftOrder(freqs_));
|
||||
size_t window_size = static_cast<size_t>(1) << RealFourier::FftOrder(freqs_);
|
||||
std::vector<float> kbd_window(window_size);
|
||||
WindowGenerator::KaiserBesselDerived(kKbdAlpha, window_size,
|
||||
kbd_window.data());
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user