X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=mware%2Fbyteorder.h;h=befc15664fbf49647461d9b994dccac43b2399e4;hb=8b022f0d098ab63e708d05634b6d1b3f1dc58815;hp=65392535ccd44113122346798451dca845834d7f;hpb=13ec95fc46065b689287f537b61f2e6607be1653;p=bertos.git diff --git a/mware/byteorder.h b/mware/byteorder.h index 65392535..befc1566 100755 --- a/mware/byteorder.h +++ b/mware/byteorder.h @@ -1,8 +1,8 @@ -/*! +/** * \file * * * \brief Functions to convert integers to/from host byte-order. @@ -15,6 +15,12 @@ /*#* *#* $Log$ + *#* Revision 1.10 2006/06/10 05:37:03 bernie + *#* Convert to new Doxygen comments. + *#* + *#* Revision 1.9 2005/11/04 16:20:02 bernie + *#* Fix reference to README.devlib in header. + *#* *#* Revision 1.8 2005/06/14 06:16:03 bernie *#* Add all missing functions. *#* @@ -47,7 +53,7 @@ #include #include -/*! +/** * Swap upper and lower bytes in a 16-bit value. */ INLINE uint16_t swab16(uint16_t x) @@ -56,7 +62,7 @@ INLINE uint16_t swab16(uint16_t x) | ((x & (uint16_t)0xFF00U) >> 8); } -/*! +/** * Reverse bytes in a 32-bit value (e.g.: 0x12345678 -> 0x78563412). */ INLINE uint32_t swab32(uint32_t x) @@ -67,7 +73,7 @@ INLINE uint32_t swab32(uint32_t x) | ((x & (uint32_t)0xFF000000UL) >> 24); } -/*! +/** * Reverse bytes in a float value. */ INLINE float swab_float(float x) @@ -174,7 +180,7 @@ INLINE float net_to_host_float(float x) #ifdef __cplusplus -//! Type generic byte swapping. +/// Type generic byte swapping. template INLINE T swab(T x); @@ -184,42 +190,42 @@ template<> INLINE int16_t swab(int16_t x) { return static_cast(swab16 template<> INLINE int32_t swab(int32_t x) { return static_cast(swab32(static_cast(x))); } template<> INLINE float swab(float x) { return swab_float(x); } -//! Type generic conversion from CPU byte order to big-endian byte order. +/// Type generic conversion from CPU byte order to big-endian byte order. template 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. +/// Type generic conversion from CPU byte-order to little-endian. template 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. +/// Type generic conversion from big endian byte-order to CPU byte order. template INLINE T be_to_cpu(T x) { return cpu_to_be(x); } -//! Type generic conversion from little-endian byte order to CPU byte order. +/// Type generic conversion from little-endian byte order to CPU byte order. template INLINE T le_to_cpu(T x) { return cpu_to_le(x); } -//! Type generic conversion from network byte order to host byte order. +/// Type generic conversion from network byte order to host byte order. template INLINE T net_to_host(T x) { return be_to_cpu(x); } -//! Type generic conversion from host byte order to network byte order. +/// Type generic conversion from host byte order to network byte order. template INLINE T host_to_net(T x) {