Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id C249E200D17 for ; Sun, 8 Oct 2017 19:04:15 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id C0E301609E6; Sun, 8 Oct 2017 17:04:15 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 125661609D3 for ; Sun, 8 Oct 2017 19:04:14 +0200 (CEST) Received: (qmail 85397 invoked by uid 500); 8 Oct 2017 17:04:14 -0000 Mailing-List: contact commits-help@arrow.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@arrow.apache.org Delivered-To: mailing list commits@arrow.apache.org Received: (qmail 85388 invoked by uid 99); 8 Oct 2017 17:04:14 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 08 Oct 2017 17:04:14 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 2C414F57FA; Sun, 8 Oct 2017 17:04:14 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: wesm@apache.org To: commits@arrow.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: arrow git commit: ARROW-1656: [C++] Endianness Macro is Incorrect on Windows And Mac Date: Sun, 8 Oct 2017 17:04:14 +0000 (UTC) archived-at: Sun, 08 Oct 2017 17:04:15 -0000 Repository: arrow Updated Branches: refs/heads/master 208e79812 -> 33d446dd4 ARROW-1656: [C++] Endianness Macro is Incorrect on Windows And Mac Author: Phillip Cloud Closes #1184 from cpcloud/ARROW-1656 and squashes the following commits: 04a92621 [Phillip Cloud] ARROW-1656: [C++] Endianness Macro is Incorrect on Windows And Mac Project: http://git-wip-us.apache.org/repos/asf/arrow/repo Commit: http://git-wip-us.apache.org/repos/asf/arrow/commit/33d446dd Tree: http://git-wip-us.apache.org/repos/asf/arrow/tree/33d446dd Diff: http://git-wip-us.apache.org/repos/asf/arrow/diff/33d446dd Branch: refs/heads/master Commit: 33d446dd4d69cfc6cbbf91cd7af51c6c7d6eee8f Parents: 208e798 Author: Phillip Cloud Authored: Sun Oct 8 13:04:02 2017 -0400 Committer: Wes McKinney Committed: Sun Oct 8 13:04:02 2017 -0400 ---------------------------------------------------------------------- cpp/src/arrow/util/bit-util.h | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/arrow/blob/33d446dd/cpp/src/arrow/util/bit-util.h ---------------------------------------------------------------------- diff --git a/cpp/src/arrow/util/bit-util.h b/cpp/src/arrow/util/bit-util.h index dd10245..2509de2 100644 --- a/cpp/src/arrow/util/bit-util.h +++ b/cpp/src/arrow/util/bit-util.h @@ -18,13 +18,29 @@ #ifndef ARROW_UTIL_BIT_UTIL_H #define ARROW_UTIL_BIT_UTIL_H -#if defined(__APPLE__) +#ifdef _WIN32 +#define ARROW_LITTLE_ENDIAN 1 +#else +#ifdef __APPLE__ #include -#elif defined(_WIN32) -#define __LITTLE_ENDIAN 1 #else #include #endif +# +#ifndef __BYTE_ORDER__ +#error "__BYTE_ORDER__ not defined" +#endif +# +#ifndef __ORDER_LITTLE_ENDIAN__ +#error "__ORDER_LITTLE_ENDIAN__ not defined" +#endif +# +#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ +#define ARROW_LITTLE_ENDIAN 1 +#else +#define ARROW_LITTLE_ENDIAN 0 +#endif +#endif #if defined(_MSC_VER) #define ARROW_BYTE_SWAP64 _byteswap_uint64 @@ -324,7 +340,7 @@ static inline void ByteSwap(void* dst, const void* src, int len) { /// Converts to big endian format (if not already in big endian) from the /// machine's native endian format. -#if __BYTE_ORDER == __LITTLE_ENDIAN +#if ARROW_LITTLE_ENDIAN static inline int64_t ToBigEndian(int64_t value) { return ByteSwap(value); } static inline uint64_t ToBigEndian(uint64_t value) { return ByteSwap(value); } static inline int32_t ToBigEndian(int32_t value) { return ByteSwap(value); } @@ -341,7 +357,7 @@ static inline uint16_t ToBigEndian(uint16_t val) { return val; } #endif /// Converts from big endian format to the machine's native endian format. -#if __BYTE_ORDER == __LITTLE_ENDIAN +#if ARROW_LITTLE_ENDIAN static inline int64_t FromBigEndian(int64_t value) { return ByteSwap(value); } static inline uint64_t FromBigEndian(uint64_t value) { return ByteSwap(value); } static inline int32_t FromBigEndian(int32_t value) { return ByteSwap(value); }