diff mbox series

[v1,2/3] linux-gen: byteorder: internal inline functions

Message ID 1516377654-1536-3-git-send-email-odpbot@yandex.ru
State New
Headers show
Series [v1,1/3] linux-gen: remove static_inline header | expand

Commit Message

Github ODP bot Jan. 19, 2018, 4 p.m. UTC
From: Petri Savolainen <petri.savolainen@linaro.org>


Define inline functions for internal use. Implementation uses
always internally inlined version. Application uses inlined
version only in non ABI compatible mode.

Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org>

---
/** Email created from pull request 409 (psavol:master-byteorder-inline)
 ** https://github.com/Linaro/odp/pull/409
 ** Patch: https://github.com/Linaro/odp/pull/409.patch
 ** Base sha: 5a4502fc6bc53e6503169da3028f456b64811a0b
 ** Merge commit sha: 7bc84d4d2e3971744d4dd9194ac9e8ec3182af09
 **/
 platform/linux-generic/Makefile.am                 |  1 +
 .../include-abi/odp/api/abi/byteorder.h            |  1 +
 .../include/odp/api/plat/byteorder_inlines.h       | 24 +++---
 .../include/odp/api/plat/byteorder_inlines_api.h   | 88 ++++++++++++++++++++++
 platform/linux-generic/odp_byteorder.c             |  1 +
 5 files changed, 103 insertions(+), 12 deletions(-)
 create mode 100644 platform/linux-generic/include/odp/api/plat/byteorder_inlines_api.h
diff mbox series

Patch

diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/Makefile.am
index 9b7ee37e5..8585080df 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -24,6 +24,7 @@  odpapiplatincludedir= $(includedir)/odp/api/plat
 odpapiplatinclude_HEADERS = \
 		  include/odp/api/plat/atomic_inlines.h \
 		  include/odp/api/plat/byteorder_inlines.h \
+		  include/odp/api/plat/byteorder_inlines_api.h \
 		  include/odp/api/plat/packet_flag_inlines.h \
 		  include/odp/api/plat/packet_flag_inlines_api.h \
 		  include/odp/api/plat/packet_inline_types.h \
diff --git a/platform/linux-generic/include-abi/odp/api/abi/byteorder.h b/platform/linux-generic/include-abi/odp/api/abi/byteorder.h
index da07c0eb0..ee03a17be 100644
--- a/platform/linux-generic/include-abi/odp/api/abi/byteorder.h
+++ b/platform/linux-generic/include-abi/odp/api/abi/byteorder.h
@@ -77,6 +77,7 @@  typedef uint32_t __odp_bitwise  odp_u32sum_t;
 
 #define _ODP_INLINE static inline
 #include <odp/api/plat/byteorder_inlines.h>
+#include <odp/api/plat/byteorder_inlines_api.h>
 
 /**
  * @}
diff --git a/platform/linux-generic/include/odp/api/plat/byteorder_inlines.h b/platform/linux-generic/include/odp/api/plat/byteorder_inlines.h
index 2f96863b7..b559d4f04 100644
--- a/platform/linux-generic/include/odp/api/plat/byteorder_inlines.h
+++ b/platform/linux-generic/include/odp/api/plat/byteorder_inlines.h
@@ -43,7 +43,7 @@  extern "C" {
 #define __odp_builtin_bswap16(u16) __builtin_bswap16(u16)
 #endif
 
-_ODP_INLINE uint16_t odp_be_to_cpu_16(odp_u16be_t be16)
+static inline uint16_t _odp_be_to_cpu_16(odp_u16be_t be16)
 {
 #if ODP_BYTE_ORDER == ODP_LITTLE_ENDIAN
 	return __odp_builtin_bswap16((__odp_force uint16_t)be16);
@@ -52,7 +52,7 @@  _ODP_INLINE uint16_t odp_be_to_cpu_16(odp_u16be_t be16)
 #endif
 }
 
-_ODP_INLINE uint32_t odp_be_to_cpu_32(odp_u32be_t be32)
+static inline uint32_t _odp_be_to_cpu_32(odp_u32be_t be32)
 {
 #if ODP_BYTE_ORDER == ODP_LITTLE_ENDIAN
 	return __builtin_bswap32((__odp_force uint32_t)be32);
@@ -61,7 +61,7 @@  _ODP_INLINE uint32_t odp_be_to_cpu_32(odp_u32be_t be32)
 #endif
 }
 
-_ODP_INLINE uint64_t odp_be_to_cpu_64(odp_u64be_t be64)
+static inline uint64_t _odp_be_to_cpu_64(odp_u64be_t be64)
 {
 #if ODP_BYTE_ORDER == ODP_LITTLE_ENDIAN
 	return __builtin_bswap64((__odp_force uint64_t)be64);
@@ -70,7 +70,7 @@  _ODP_INLINE uint64_t odp_be_to_cpu_64(odp_u64be_t be64)
 #endif
 }
 
-_ODP_INLINE odp_u16be_t odp_cpu_to_be_16(uint16_t cpu16)
+static inline odp_u16be_t _odp_cpu_to_be_16(uint16_t cpu16)
 {
 #if ODP_BYTE_ORDER == ODP_LITTLE_ENDIAN
 	return (__odp_force odp_u16be_t)__odp_builtin_bswap16(cpu16);
@@ -79,7 +79,7 @@  _ODP_INLINE odp_u16be_t odp_cpu_to_be_16(uint16_t cpu16)
 #endif
 }
 
-_ODP_INLINE odp_u32be_t odp_cpu_to_be_32(uint32_t cpu32)
+static inline odp_u32be_t _odp_cpu_to_be_32(uint32_t cpu32)
 {
 #if ODP_BYTE_ORDER == ODP_LITTLE_ENDIAN
 	return (__odp_force odp_u32be_t)__builtin_bswap32(cpu32);
@@ -88,7 +88,7 @@  _ODP_INLINE odp_u32be_t odp_cpu_to_be_32(uint32_t cpu32)
 #endif
 }
 
-_ODP_INLINE odp_u64be_t odp_cpu_to_be_64(uint64_t cpu64)
+static inline odp_u64be_t _odp_cpu_to_be_64(uint64_t cpu64)
 {
 #if ODP_BYTE_ORDER == ODP_LITTLE_ENDIAN
 	return (__odp_force odp_u64be_t)__builtin_bswap64(cpu64);
@@ -97,7 +97,7 @@  _ODP_INLINE odp_u64be_t odp_cpu_to_be_64(uint64_t cpu64)
 #endif
 }
 
-_ODP_INLINE uint16_t odp_le_to_cpu_16(odp_u16le_t le16)
+static inline uint16_t _odp_le_to_cpu_16(odp_u16le_t le16)
 {
 #if ODP_BYTE_ORDER == ODP_LITTLE_ENDIAN
 	return (__odp_force uint16_t)le16;
@@ -106,7 +106,7 @@  _ODP_INLINE uint16_t odp_le_to_cpu_16(odp_u16le_t le16)
 #endif
 }
 
-_ODP_INLINE uint32_t odp_le_to_cpu_32(odp_u32le_t le32)
+static inline uint32_t _odp_le_to_cpu_32(odp_u32le_t le32)
 {
 #if ODP_BYTE_ORDER == ODP_LITTLE_ENDIAN
 	return (__odp_force uint32_t)le32;
@@ -115,7 +115,7 @@  _ODP_INLINE uint32_t odp_le_to_cpu_32(odp_u32le_t le32)
 #endif
 }
 
-_ODP_INLINE uint64_t odp_le_to_cpu_64(odp_u64le_t le64)
+static inline uint64_t _odp_le_to_cpu_64(odp_u64le_t le64)
 {
 #if ODP_BYTE_ORDER == ODP_LITTLE_ENDIAN
 	return (__odp_force uint64_t)le64;
@@ -124,7 +124,7 @@  _ODP_INLINE uint64_t odp_le_to_cpu_64(odp_u64le_t le64)
 #endif
 }
 
-_ODP_INLINE odp_u16le_t odp_cpu_to_le_16(uint16_t cpu16)
+static inline odp_u16le_t _odp_cpu_to_le_16(uint16_t cpu16)
 {
 #if ODP_BYTE_ORDER == ODP_LITTLE_ENDIAN
 	return (__odp_force odp_u16le_t)cpu16;
@@ -133,7 +133,7 @@  _ODP_INLINE odp_u16le_t odp_cpu_to_le_16(uint16_t cpu16)
 #endif
 }
 
-_ODP_INLINE odp_u32le_t odp_cpu_to_le_32(uint32_t cpu32)
+static inline odp_u32le_t _odp_cpu_to_le_32(uint32_t cpu32)
 {
 #if ODP_BYTE_ORDER == ODP_LITTLE_ENDIAN
 	return (__odp_force odp_u32le_t)cpu32;
@@ -142,7 +142,7 @@  _ODP_INLINE odp_u32le_t odp_cpu_to_le_32(uint32_t cpu32)
 #endif
 }
 
-_ODP_INLINE odp_u64le_t odp_cpu_to_le_64(uint64_t cpu64)
+static inline odp_u64le_t _odp_cpu_to_le_64(uint64_t cpu64)
 {
 #if ODP_BYTE_ORDER == ODP_LITTLE_ENDIAN
 	return (__odp_force odp_u64le_t)cpu64;
diff --git a/platform/linux-generic/include/odp/api/plat/byteorder_inlines_api.h b/platform/linux-generic/include/odp/api/plat/byteorder_inlines_api.h
new file mode 100644
index 000000000..ef81d74db
--- /dev/null
+++ b/platform/linux-generic/include/odp/api/plat/byteorder_inlines_api.h
@@ -0,0 +1,88 @@ 
+/* Copyright (c) 2018, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+
+/**
+ * @file
+ *
+ * ODP byteorder
+ */
+
+#ifndef ODP_PLAT_BYTEORDER_INLINES_API_H_
+#define ODP_PLAT_BYTEORDER_INLINES_API_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+_ODP_INLINE uint16_t odp_be_to_cpu_16(odp_u16be_t be16)
+{
+	return _odp_be_to_cpu_16(be16);
+}
+
+_ODP_INLINE uint32_t odp_be_to_cpu_32(odp_u32be_t be32)
+{
+	return _odp_be_to_cpu_32(be32);
+}
+
+_ODP_INLINE uint64_t odp_be_to_cpu_64(odp_u64be_t be64)
+{
+	return _odp_be_to_cpu_64(be64);
+}
+
+_ODP_INLINE odp_u16be_t odp_cpu_to_be_16(uint16_t cpu16)
+{
+	return _odp_cpu_to_be_16(cpu16);
+}
+
+_ODP_INLINE odp_u32be_t odp_cpu_to_be_32(uint32_t cpu32)
+{
+	return _odp_cpu_to_be_32(cpu32);
+}
+
+_ODP_INLINE odp_u64be_t odp_cpu_to_be_64(uint64_t cpu64)
+{
+	return _odp_cpu_to_be_64(cpu64);
+}
+
+_ODP_INLINE uint16_t odp_le_to_cpu_16(odp_u16le_t le16)
+{
+	return _odp_le_to_cpu_16(le16);
+}
+
+_ODP_INLINE uint32_t odp_le_to_cpu_32(odp_u32le_t le32)
+{
+	return _odp_le_to_cpu_32(le32);
+}
+
+_ODP_INLINE uint64_t odp_le_to_cpu_64(odp_u64le_t le64)
+{
+	return _odp_le_to_cpu_64(le64);
+}
+
+_ODP_INLINE odp_u16le_t odp_cpu_to_le_16(uint16_t cpu16)
+{
+	return _odp_cpu_to_le_16(cpu16);
+}
+
+_ODP_INLINE odp_u32le_t odp_cpu_to_le_32(uint32_t cpu32)
+{
+	return _odp_cpu_to_le_32(cpu32);
+}
+
+_ODP_INLINE odp_u64le_t odp_cpu_to_le_64(uint64_t cpu64)
+{
+	return _odp_cpu_to_le_64(cpu64);
+}
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/platform/linux-generic/odp_byteorder.c b/platform/linux-generic/odp_byteorder.c
index ff0b74b23..9cfb05d3e 100644
--- a/platform/linux-generic/odp_byteorder.c
+++ b/platform/linux-generic/odp_byteorder.c
@@ -11,3 +11,4 @@ 
 /* Include non-inlined versions of API functions */
 #define _ODP_INLINE
 #include <odp/api/plat/byteorder_inlines.h>
+#include <odp/api/plat/byteorder_inlines_api.h>