Skip to content

Commit

Permalink
Reduce unnecessary checks
Browse files Browse the repository at this point in the history
If `have_header` returns `false`, `have_func` using that header also
return `false` always, because that header cannot be included.
  • Loading branch information
nobu committed Sep 9, 2024
1 parent 33b5374 commit 8fa7712
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions ext/bigdecimal/extconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,17 @@ def have_builtin_func(name, check_expr, opt = "", &b)
have_header("stdbool.h")
have_header("stdlib.h")

have_header("x86intrin.h")
have_func("_lzcnt_u32", "x86intrin.h")
have_func("_lzcnt_u64", "x86intrin.h")

have_header("intrin.h")
have_func("__lzcnt", "intrin.h")
have_func("__lzcnt64", "intrin.h")
have_func("_BitScanReverse", "intrin.h")
have_func("_BitScanReverse64", "intrin.h")
if have_header("x86intrin.h")
have_func("_lzcnt_u32", "x86intrin.h")
have_func("_lzcnt_u64", "x86intrin.h")
end

if have_header("intrin.h")
have_func("__lzcnt", "intrin.h")
have_func("__lzcnt64", "intrin.h")
have_func("_BitScanReverse", "intrin.h")
have_func("_BitScanReverse64", "intrin.h")
end

have_func("labs", "stdlib.h")
have_func("llabs", "stdlib.h")
Expand Down

0 comments on commit 8fa7712

Please sign in to comment.