Port timeout.c to platforms without __builtin_c[tl]z
This patch includes an intrinsic implementation for these functions when the compiler is GCC, Clang, or MSVC--or if the compiler claims to be one of those. Otherwise, a naive implementation is used. Tests are included for all of these functions, which turned up a possible problem: according to the gcc documentation, __builtin_ctz and __builtin_clz give an undefined result when their inputs is zero. I was not able to persuade myself that we always called them with a nonzero argument.
Showing
bitops.c
0 → 100644
Please register or sign in to comment