[PATCH] D91968: llvm/ADT/StringExtras.h hexDigitValue - Init of integer buffer

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 23 08:38:46 PST 2020


lebedev.ri added inline comments.


================
Comment at: llvm/include/llvm/ADT/StringExtras.h:70
   struct HexTable {
-    unsigned LUT[255] = {};
+    unsigned LUT[255] = {static_cast<unsigned>(-1)};
     constexpr HexTable() {
----------------
This doesn't fill the entire array with -1
https://godbolt.org/z/G3Yqbh


================
Comment at: llvm/include/llvm/ADT/StringExtras.h:74
-      for (int i = 0; i < 255; ++i)
-        LUT[i] = -1U;
       // Initialize `0`-`9`.
----------------
How about just `~0U` ?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D91968/new/

https://reviews.llvm.org/D91968



More information about the llvm-commits mailing list