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

Sam Elliott via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 11 08:20:59 PST 2022


lenary 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;
----------------
dexonsmith wrote:
> Can we use `if constexpr` here? Or is that not supported by all compilers yet?
I forgot this was something we could do, but LLVM is C++17, so it should be allowed, I believe.


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


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