You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by ma...@apache.org on 2018/04/14 15:11:53 UTC

[trafficserver] branch master updated: Add be64toh and htobe64 for macOS

This is an automated email from the ASF dual-hosted git repository.

maskit pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
     new 858844d  Add be64toh and htobe64 for macOS
858844d is described below

commit 858844d7364b20d46d449d5131d96df3419e75df
Author: Masakazu Kitajo <ma...@apache.org>
AuthorDate: Fri Apr 13 11:43:07 2018 +0900

    Add be64toh and htobe64 for macOS
---
 configure.ac          |  1 +
 lib/ts/ink_endian.h   | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++
 lib/ts/ink_platform.h | 10 +---------
 3 files changed, 53 insertions(+), 9 deletions(-)

diff --git a/configure.ac b/configure.ac
index bea5002..8053739 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1638,6 +1638,7 @@ AC_CHECK_HEADERS([sys/types.h \
                   sys/pset.h \
                   sched.h \
                   pthread.h \
+                  sys/endian.h \
                   machine/endian.h \
                   endian.h \
                   sys/sysinfo.h \
diff --git a/lib/ts/ink_endian.h b/lib/ts/ink_endian.h
new file mode 100644
index 0000000..30b3132
--- /dev/null
+++ b/lib/ts/ink_endian.h
@@ -0,0 +1,51 @@
+/** @file
+ *
+ *  Endian convertion routines
+ *
+ *  @section license License
+ *
+ *  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.
+ */
+
+#pragma once
+
+#ifdef HAVE_SYS_ENDIAN_H
+#include <sys/endian.h>
+#endif
+#ifdef HAVE_MACHINE_ENDIAN_H
+#include <machine/endian.h>
+#endif
+#ifdef HAVE_ENDIAN_H
+#include <endian.h>
+#endif
+#ifdef HAVE_SYS_BYTEORDER_H
+#include <sys/byteorder.h>
+#endif
+
+#if defined(darwin)
+#include <libkern/OSByteOrder.h>
+inline uint64_t
+be64toh(uint64_t x)
+{
+  return OSSwapBigToHostInt64(x);
+}
+inline uint64_t
+htobe64(uint64_t x)
+{
+  return OSSwapHostToBigInt64(x);
+}
+#endif
diff --git a/lib/ts/ink_platform.h b/lib/ts/ink_platform.h
index fe7835c..18e6fa2 100644
--- a/lib/ts/ink_platform.h
+++ b/lib/ts/ink_platform.h
@@ -137,15 +137,7 @@ struct ifafilt;
 #include <stropts.h>
 #endif
 
-#ifdef HAVE_MACHINE_ENDIAN_H
-#include <machine/endian.h>
-#endif
-#ifdef HAVE_ENDIAN_H
-#include <endian.h>
-#endif
-#ifdef HAVE_SYS_BYTEORDER_H
-#include <sys/byteorder.h>
-#endif
+#include "ink_endian.h"
 
 #ifdef HAVE_SYS_IOCTL_H
 #include <sys/ioctl.h>

-- 
To stop receiving notification emails like this one, please contact
maskit@apache.org.