[PATCH] D137834: [Support] Reduce Dependence on Host.h

Duncan P. N. Exon Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 11 07:54:02 PST 2022


dexonsmith added inline comments.


================
Comment at: llvm/lib/Support/SHA1.cpp:191
 void SHA1::addUncounted(uint8_t Data) {
-#ifdef SHA_BIG_ENDIAN
-  InternalState.Buffer.C[InternalState.BufferOffset] = Data;
-#else
-  InternalState.Buffer.C[InternalState.BufferOffset ^ 3] = Data;
-#endif
+  if (sys::IsBigEndianHost) {
+    InternalState.Buffer.C[InternalState.BufferOffset] = Data;
----------------
Can we use `if constexpr` here? Or is that not supported by all compilers yet?


================
Comment at: llvm/lib/Support/SHA1.cpp:193
+    InternalState.Buffer.C[InternalState.BufferOffset] = Data;
+  } else {
+    InternalState.Buffer.C[InternalState.BufferOffset ^ 3] = Data;
----------------
I think usual LLVM style only uses braces when there are multiple lines on at least one side.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137834



More information about the llvm-commits mailing list