• Nick Mathewson's avatar
    Port timeout.c to platforms without __builtin_c[tl]z · 7311ebae
    Nick Mathewson authored
    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.
    7311ebae
bitops.c 4.32 KB