From: Darius Augulis <[email protected]> Fix documentation of existing helpers and add big-endian helpers.
Signed-off-by: Darius Augulis <[email protected]> Index: wimax-tools/include/wimaxll.h =================================================================== --- wimax-tools.orig/include/wimaxll.h +++ wimax-tools/include/wimaxll.h @@ -390,7 +390,7 @@ unsigned long wimaxll_swap_32(unsigned l static inline // ugly hack for doxygen /** - * Convert a little-endian 16 bits to cpu order. + * Convert a cpu-order 16 bits to little endian. * * \ingroup miscellaneous_group * \fn unsigned short wimaxll_cpu_to_le16(unsigned short x) @@ -411,7 +411,7 @@ unsigned short wimaxll_cpu_to_le16(unsig static inline // ugly hack for doxygen /** - * Convert a cpu-order 16 bits to little endian. + * Convert a little-endian 16 bits to cpu order. * * \ingroup miscellaneous_group * \fn unsigned short wimaxll_le16_to_cpu(unsigned short le16) @@ -432,7 +432,7 @@ unsigned short wimaxll_le16_to_cpu(unsig static inline // ugly hack for doxygen /** - * Convert a little-endian 32 bits to cpu order. + * Convert a cpu-order 32 bits to little endian. * * \ingroup miscellaneous_group * \fn unsigned long wimaxll_cpu_to_le32(unsigned long x) @@ -453,7 +453,7 @@ unsigned long wimaxll_cpu_to_le32(unsign static inline // ugly hack for doxygen /** - * Convert a cpu-order 32 bits to little endian. + * Convert a little-endian 32 bits to cpu order. * * \ingroup miscellaneous_group * \fn unsigned long wimaxll_le32_to_cpu(unsigned long le32) @@ -471,4 +471,88 @@ unsigned long wimaxll_le32_to_cpu(unsign return cpu; } + +static inline // ugly hack for doxygen +/** + * Convert a cpu-order 16 bits to big endian. + * + * \ingroup miscellaneous_group + * \fn unsigned short wimaxll_cpu_to_be16(unsigned short x) + */ +unsigned short wimaxll_cpu_to_be16(unsigned short x) +{ + unsigned short be16; +#if __BYTE_ORDER == __LITTLE_ENDIAN + be16 = wimaxll_swap_16(x); +#elif __BYTE_ORDER == __BIG_ENDIAN + be16 = x; +#else +#error ERROR: unknown byte sex - FIXME +#endif + return be16; +} + + +static inline // ugly hack for doxygen +/** + * Convert a big-endian 16 bits to cpu order. + * + * \ingroup miscellaneous_group + * \fn unsigned short wimaxll_be16_to_cpu(unsigned short be16) + */ +unsigned short wimaxll_be16_to_cpu(unsigned short be16) +{ + unsigned short cpu; +#if __BYTE_ORDER == __LITTLE_ENDIAN + cpu = wimaxll_swap_16(be16); +#elif __BYTE_ORDER == __BIG_ENDIAN + cpu = be16; +#else +#error ERROR: unknown byte sex - FIXME +#endif + return cpu; +} + + +static inline // ugly hack for doxygen +/** + * Convert a cpu-order 32 bits to big endian. + * + * \ingroup miscellaneous_group + * \fn unsigned long wimaxll_cpu_to_be32(unsigned long x) + */ +unsigned long wimaxll_cpu_to_be32(unsigned long x) +{ + unsigned long be32; +#if __BYTE_ORDER == __LITTLE_ENDIAN + be32 = wimaxll_swap_32(x); +#elif __BYTE_ORDER == __BIG_ENDIAN + be32 = x; +#else +#error ERROR: unknown byte sex - FIXME +#endif + return be32; +} + + +static inline // ugly hack for doxygen +/** + * Convert a big-endian 32 bits to cpu order. + * + * \ingroup miscellaneous_group + * \fn unsigned long wimaxll_be32_to_cpu(unsigned long be32) + */ +unsigned long wimaxll_be32_to_cpu(unsigned long be32) +{ + unsigned long cpu; +#if __BYTE_ORDER == __LITTLE_ENDIAN + cpu = be32; +#elif __BYTE_ORDER == __BIG_ENDIAN + cpu = wimaxll_swap_32(be32); +#else +#error ERROR: unknown byte sex - FIXME +#endif + return cpu; +} + #endif /* #ifndef __lib_wimaxll_h__ */
_______________________________________________ wimax mailing list [email protected] http://www.linuxwimax.org/mailman/listinfo/wimax
