[clang] [clang]Implement the c23 stdc bit builtins (PR #185978)
Nick Desaulniers via cfe-commits
cfe-commits at lists.llvm.org
Fri Apr 10 09:46:11 PDT 2026
================
@@ -0,0 +1,19 @@
+#ifndef LLVM_CLANG_TEST_STDBIT_H
+#define LLVM_CLANG_TEST_STDBIT_H
+
+#define stdc_leading_zeros(x) (__builtin_stdc_leading_zeros((x)))
----------------
nickdesaulniers wrote:
You know this better than everyone else, but `_Generic` statements aren't usable in headers that could be parsed in C++ mode. So while this macro _could be_ implemented in terms of `_Generic` statements for C mode, you have to do something different for C++, usually duplicating the work. That's why I think GCC just shipped the type generic builtins.
https://github.com/llvm/llvm-project/pull/185978
More information about the cfe-commits
mailing list