Using __builtin_clz on gcc/clang, and a fallback implementation
otherwise.
Also redefine WebRtcSpl_GetSizeInBits(x) as simply 32 - clz32(x).
BUG=chromium:601787
Review-Url: https://codereview.webrtc.org/2014023002
Cr-Commit-Position: refs/heads/master@{#13014}
Of course, functions called WebRtcSpl_AddSatW32 and WebRtcSpl_SubSatW32 are supposed to handle overflow gracefully, and they probably did. But since the overflow handling depended on undefined behavior, a sufficiently smart optimizing compiler would have realized that it could just ignore the possibility of overflow and omit all the overflow handling code, leaving only the unadorned addition or subtraction.
Also, the new implementations, unlike the old ones, result in branch-free code (tested with clang 3.9 with -O2).
BUG=chromium:601728
Review-Url: https://codereview.webrtc.org/2002523002
Cr-Commit-Position: refs/heads/master@{#12846}
This changes some method signatures to better reflect how callers are actually
using them. This also has the tendency to make signatures more consistent about
e.g. using int (instead of int16_t) for lengths of things like vectors, and
using int16_t (instead of int) for e.g. counts of bits in a value.
This also removes a couple of functions that were only called in unittests.
BUG=3353,chromium:81439
TEST=none
R=andrew@webrtc.org, bjornv@webrtc.org
Review URL: https://webrtc-codereview.appspot.com/23389004
git-svn-id: http://webrtc.googlecode.com/svn/trunk@7060 4adac7df-926f-26a2-2b94-8c16560cd09d