From 4c8125d60d47e98b1ec84422888975111e0cbcec Mon Sep 17 00:00:00 2001 From: Allen Wittenauer Date: Fri, 27 Nov 2015 21:06:28 -0800 Subject: [PATCH] HADOOP-11505. Various native parts use bswap incorrectly and unportably (Alan Burlison via aw) --- .../hadoop-common/src/hadoop_endian.h.cmake | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 hadoop-common-project/hadoop-common/src/hadoop_endian.h.cmake diff --git a/hadoop-common-project/hadoop-common/src/hadoop_endian.h.cmake b/hadoop-common-project/hadoop-common/src/hadoop_endian.h.cmake new file mode 100644 index 0000000000..b30d9bd6ac --- /dev/null +++ b/hadoop-common-project/hadoop-common/src/hadoop_endian.h.cmake @@ -0,0 +1,43 @@ +/** +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* Hadoop versions of http://austingroupbugs.net/view.php?id=162#c665 */ + +#ifndef HADOOP_ENDIAN_H +#define HADOOP_ENDIAN_H + +#include <@HADOOP_ENDIAN_H@> + +#define HADOOP_LITTLE_ENDIAN 1234 +#define HADOOP_BIG_ENDIAN 4321 +#cmakedefine HADOOP_BYTE_ORDER @HADOOP_BYTE_ORDER@ + +#define hadoop_htobe16(X) @HADOOP_HTOBE16@(X) +#define hadoop_htole16(X) @HADOOP_HTOLE16@(X) +#define hadoop_be16toh(X) @HADOOP_BE16TOH@(X) +#define hadoop_le16toh(X) @HADOOP_LE16TOH@(X) +#define hadoop_htobe32(X) @HADOOP_HTOBE32@(X) +#define hadoop_htole32(X) @HADOOP_HTOLE32@(X) +#define hadoop_be32toh(X) @HADOOP_BE32TOH@(X) +#define hadoop_le32toh(X) @HADOOP_LE32TOH@(X) +#define hadoop_htobe64(X) @HADOOP_HTOBE64@(X) +#define hadoop_htole64(X) @HADOOP_HTOLE64@(X) +#define hadoop_be64toh(X) @HADOOP_BE64TOH@(X) +#define hadoop_le64toh(X) @HADOOP_LE64TOH@(X) + +#endif