DescriptionFix UBSan errors (left shift of negative value)
I've settled on replacing x << n with x * (1 << n); this gets rid of
the "left shift of negative value" warning, but will still trigger
undefined behavior if the multiplication overflows. It also still
looks like a left shift, which is good for the readability of the
fixed-point code.
(The compiler is smart enough to recognize that the
multiplication+shift is just a shift, for both variable and constant
shift amounts, so the generated code should not change.)
BUG=chromium:603491
Committed: https://crrev.com/64208e55232fba0a81b846091197cc68a431ee77
Cr-Commit-Position: refs/heads/master@{#12845}
Patch Set 1 : #
Messages
Total messages: 13 (6 generated)
|