[llvm] 06cc888 - [Support] Make IsLittleEndianHost constexpr (NFC) (#153125)

via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 11 22:51:28 PDT 2025


Author: Kazu Hirata
Date: 2025-08-11T22:51:25-07:00
New Revision: 06cc8880104c3f3e5c25da16709659db7a339bf0

URL: https://github.com/llvm/llvm-project/commit/06cc8880104c3f3e5c25da16709659db7a339bf0
DIFF: https://github.com/llvm/llvm-project/commit/06cc8880104c3f3e5c25da16709659db7a339bf0.diff

LOG: [Support] Make IsLittleEndianHost constexpr (NFC) (#153125)

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

Added: 
    

Modified: 
    llvm/include/llvm/Support/SwapByteOrder.h

Removed: 
    


################################################################################
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