[libc-commits] [libc] [libc][wctype] Add perfect hash map for conversion functions (PR #187670)

Muhammad Bassiouni via libc-commits libc-commits at lists.llvm.org
Sun Mar 29 04:19:53 PDT 2026


================
@@ -1,13 +1,26 @@
 add_custom_target(libc-support-wctype-tests)
 
+add_libc_test(
+  wctype_perfect_hash_test
+  SUITE
+    libc-support-wctype-tests
+  SRCS
+    wctype_perfect_hash_test.cpp
+  COMPILE_OPTIONS
+    $<$<CXX_COMPILER_ID:Clang>:-Xclang -fconstexpr-steps=10000000>
+    $<$<CXX_COMPILER_ID:GNU>:-fconstexpr-ops-limit=10000000>
----------------
bassiounix wrote:

I'm thinking about this since I faced the maximum number of `constexpr` steps in windows. Even though we generate the internal seed, pilots and remap array using Python script, we still need to increase the `constexpr` steps.

Since we have to increase it anyway, I can simplify the code much more if we just directly initialized the hasher in the code instead of using Python and `cppyy` to generate the internal state.

https://github.com/llvm/llvm-project/pull/187670


More information about the libc-commits mailing list