]> git.ozlabs.org Git - ccan/commit
configurator: Fix CTZ detection
authorRasmus Villemoes <rv@rasmusvillemoes.dk>
Tue, 7 Oct 2014 20:19:41 +0000 (22:19 +0200)
committerRusty Russell <rusty@rustcorp.com.au>
Mon, 13 Oct 2014 05:59:34 +0000 (16:29 +1030)
commit1567e4bd07b4ff64f082745fad01d1efcc8e1c0c
tree8e9a2ab8e322d196ccc36ef4950a5cdeaf12ff99
parenteee85457747816e05bbc41984fbb612438671d2d
configurator: Fix CTZ detection

The literal "1" in "1 << (sizeof(long{, long})*8 - 1)" should be 1L or
1LL, so that the expression has the right type. Otherwise, the shift
is only by 31 bits on x86 (other platforms may behave differently). To
avoid language lawyers shouting UB at me, and since
__builtin_ctz{,l,ll} formally takes unsigned parameters, use UL and
ULL suffixes.

Also, fix a typo (missing parenthesis) in the code for CTZLL causing
the detection of __builtin_ctzll to always fail for the wrong reason.

Signed-off-by: Rasmus Villemoes <rv@rasmusvillemoes.dk>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
tools/configurator/configurator.c