[llvm] [Support] Make IsLittleEndianHost constexpr (NFC) (PR #153125)

via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 11 19:57:40 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-support

Author: Kazu Hirata (kazutakahirata)

<details>
<summary>Changes</summary>

IsLittleEndianHost is a compile-time constant because IsBigEndianHost
also is.


---
Full diff: https://github.com/llvm/llvm-project/pull/153125.diff


1 Files Affected:

- (modified) llvm/include/llvm/Support/SwapByteOrder.h (+1-1) 


``````````diff
diff --git a/llvm/include/llvm/Support/SwapByteOrder.h b/llvm/include/llvm/Support/SwapByteOrder.h
index e6d4c26838c6a..e9d528111609d 100644
--- a/llvm/include/llvm/Support/SwapByteOrder.h
+++ b/llvm/include/llvm/Support/SwapByteOrder.h
@@ -26,7 +26,7 @@ namespace sys {
 constexpr bool IsBigEndianHost =
     llvm::endianness::native == llvm::endianness::big;
 
-static const bool IsLittleEndianHost = !IsBigEndianHost;
+constexpr bool IsLittleEndianHost = !IsBigEndianHost;
 
 inline unsigned char      getSwappedBytes(unsigned char      C) { return llvm::byteswap(C); }
 inline   signed char      getSwappedBytes( signed  char      C) { return llvm::byteswap(C); }

``````````

</details>


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


More information about the llvm-commits mailing list