[llvm] [Support] Make IsLittleEndianHost constexpr (NFC) (PR #153125)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 11 19:57:05 PDT 2025
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/153125
IsLittleEndianHost is a compile-time constant because IsBigEndianHost
also is.
>From 34c47056ab405e05b12586c1a4206f0b334d2d65 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Sat, 9 Aug 2025 10:42:56 -0700
Subject: [PATCH] [Support] Make IsLittleEndianHost constexpr (NFC)
IsLittleEndianHost is a compile-time constant because IsBigEndianHost
also is.
---
llvm/include/llvm/Support/SwapByteOrder.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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); }
More information about the llvm-commits
mailing list