Created
November 8, 2013 11:14
-
-
Save SamuelMarks/7369603 to your computer and use it in GitHub Desktop.
Endianness checks replacement for LLVM (posted to llvm-commits)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 346740535fe71b34218fa1137a14e6ed8f6833ae Mon Sep 17 00:00:00 2001 | |
From: Samuel Marks <[email protected]> | |
Date: Fri, 8 Nov 2013 22:04:06 +1100 | |
Subject: [PATCH] Added support for the BSDs and Solaris endianness; code from | |
ChromiumOS project (LevelDB ppl) | |
--- | |
include/llvm/Support/Host.h | 17 ++++++++++------- | |
1 file changed, 10 insertions(+), 7 deletions(-) | |
diff --git a/include/llvm/Support/Host.h b/include/llvm/Support/Host.h | |
index 0f45d4b..5ac7b2d 100644 | |
--- a/include/llvm/Support/Host.h | |
+++ b/include/llvm/Support/Host.h | |
@@ -16,6 +16,7 @@ | |
#include "llvm/ADT/StringMap.h" | |
+ | |
#if defined(OS_MACOSX) | |
#include <machine/endian.h> | |
#elif defined(OS_SOLARIS) | |
@@ -29,8 +30,10 @@ | |
defined(OS_DRAGONFLYBSD) | |
#include <sys/types.h> | |
#include <sys/endian.h> | |
-#else | |
- #include <endian.h> | |
+ #else | |
+ #if !defined(BYTE_ORDER) && !defined(LLVM_ON_WIN32) | |
+ #include <endian.h> | |
+ #endif | |
#endif | |
#include <string> | |
@@ -38,11 +41,11 @@ | |
namespace llvm { | |
namespace sys { | |
-#if defined(BIG_ENDIAN) | |
- static const bool IsBigEndianHost = true, IsLittleEndianHost = false; | |
-#else | |
- static const bool IsBigEndianHost = false, IsLittleEndianHost = true; | |
-#endif | |
+ #if defined(BIG_ENDIAN) | |
+ static const bool IsBigEndianHost = true, IsLittleEndianHost = false; | |
+ #else | |
+ static const bool IsBigEndianHost = false, IsLittleEndianHost = true; | |
+ #endif | |
/// getDefaultTargetTriple() - Return the default target triple the compiler | |
/// has been configured to produce code for. | |
-- | |
1.8.3.msysgit.0 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment