Add clz functions (Count number of Leading Zero bits), 32-and 64-bit variants
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}
This commit is contained in:
@ -11,14 +11,11 @@
|
||||
#ifndef WEBRTC_SYSTEM_WRAPPERS_INCLUDE_COMPILE_ASSERT_H_
|
||||
#define WEBRTC_SYSTEM_WRAPPERS_INCLUDE_COMPILE_ASSERT_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
#error "Only use this for C files. For C++, use static_assert."
|
||||
#endif
|
||||
|
||||
// Use this macro to verify at compile time that certain restrictions are met.
|
||||
// The argument is the boolean expression to evaluate.
|
||||
// Example:
|
||||
// COMPILE_ASSERT(sizeof(foo) < 128);
|
||||
// Note: In C++, use static_assert instead!
|
||||
#define COMPILE_ASSERT(expression) switch (0) {case 0: case expression:;}
|
||||
|
||||
#endif // WEBRTC_SYSTEM_WRAPPERS_INCLUDE_COMPILE_ASSERT_H_
|
||||
|
||||
Reference in New Issue
Block a user