+INLINE float net_to_host_float(float x)
+{
+ return be_float_to_cpu(x);
+}
+
+#ifdef __cplusplus
+
+//! Type generic byte swapping.
+template<typename T>
+INLINE T swab(T x);
+
+template<> INLINE uint16_t swab(uint16_t x) { return swab16(x); }
+template<> INLINE uint32_t swab(uint32_t x) { return swab32(x); }
+template<> INLINE int16_t swab(int16_t x) { return static_cast<int16_t>(swab16(static_cast<uint16_t>(x))); }
+template<> INLINE int32_t swab(int32_t x) { return static_cast<int32_t>(swab32(static_cast<uint32_t>(x))); }
+template<> INLINE float swab(float x) { return swab_float(x); }
+
+//! Type generic conversion from CPU byte order to big-endian byte order.
+template<typename T>
+INLINE T cpu_to_be(T x)
+{
+ return (CPU_BYTE_ORDER == CPU_LITTLE_ENDIAN) ? swab(x) : x;
+}
+
+//! Type generic conversion from CPU byte-order to little-endian.
+template<typename T>
+INLINE T cpu_to_le(T x)
+{
+ return (CPU_BYTE_ORDER == CPU_BIG_ENDIAN) ? swab(x) : x;
+}
+
+//! Type generic conversion from big endian byte-order to CPU byte order.
+template<typename T>
+INLINE T be_to_cpu(T x)
+{
+ return cpu_to_be(x);
+}
+
+//! Type generic conversion from little-endian byte order to CPU byte order.
+template<typename T>
+INLINE T le_to_cpu(T x)
+{
+ return cpu_to_le(x);
+}
+
+//! Type generic conversion from network byte order to host byte order.
+template<typename T>
+INLINE T net_to_host(T x)
+{
+ return be_to_cpu(x);
+}
+
+//! Type generic conversion from host byte order to network byte order.
+template<typename T>
+INLINE T host_to_net(T x)
+{
+ return net_to_host(x);
+}
+
+#endif /* __cplusplus */
+