diff options
author | Darius Augulis <augulis.darius@gmail.com> | 2009-04-29 09:24:08 -0700 |
---|---|---|
committer | Inaky Perez-Gonzalez <inaky@linux.intel.com> | 2009-04-29 09:34:10 -0700 |
commit | f889c22472bd03e2ca9767da3a7435ad553a329f (patch) | |
tree | e57d52a98e95d7126859854978efe1cbade132bb | |
parent | 3f8746784c9da49bd9940e3f21e5a9af945bdc0a (diff) |
Fix documentation of existing helpers and add big-endian helpers.
Signed-off-by: Darius Augulis <augulis.darius@gmail.com>
-rw-r--r-- | include/wimaxll.h | 92 |
1 files changed, 88 insertions, 4 deletions
diff --git a/include/wimaxll.h b/include/wimaxll.h index 87253bb..5c4f4e2 100644 --- a/include/wimaxll.h +++ b/include/wimaxll.h @@ -403,7 +403,7 @@ unsigned long wimaxll_swap_32(unsigned long x) 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) @@ -424,7 +424,7 @@ unsigned short wimaxll_cpu_to_le16(unsigned short x) 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) @@ -445,7 +445,7 @@ unsigned short wimaxll_le16_to_cpu(unsigned short le16) 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) @@ -466,7 +466,7 @@ unsigned long wimaxll_cpu_to_le32(unsigned long x) 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) @@ -484,4 +484,88 @@ unsigned long wimaxll_le32_to_cpu(unsigned long le32) 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__ */ |