Minor documentation fix for the RelayBoard project.
[pub/USBasp.git] / LUFA / Common / Endianness.h
index ef8c1a7..58f8012 100644 (file)
 #ifndef __LUFA_ENDIANNESS_H__\r
 #define __LUFA_ENDIANNESS_H__\r
 \r
+       /* Enable C linkage for C++ Compilers: */\r
+               #if defined(__cplusplus)\r
+                       extern "C" {\r
+               #endif\r
+\r
        /* Preprocessor Checks: */\r
                #if !defined(__INCLUDE_FROM_COMMON_H)\r
                        #error Do not include this file directly. Include LUFA/Common/Common.h instead to gain this functionality.\r
@@ -78,7 +83,7 @@
                         *\r
                         *  \return Input value with the byte ordering reversed.\r
                         */\r
-                       #define SWAPENDIAN_16(x)          ((((x) & 0xFF00) >> 8) | (((x) & 0x00FF) << 8))\r
+                       #define SWAPENDIAN_16(x)            (uint16_t)((((x) & 0xFF00) >> 8) | (((x) & 0x00FF) << 8))\r
 \r
                        /** Swaps the byte ordering of a 32-bit value at compile-time. Do not use this macro for swapping byte orderings\r
                         *  of dynamic values computed at runtime- use \ref SwapEndian_32() instead. The result of this macro can be used\r
@@ -91,8 +96,8 @@
                         *\r
                         *  \return Input value with the byte ordering reversed.\r
                         */\r
-                       #define SWAPENDIAN_32(x)          ((((x) & 0xFF000000UL) >> 24UL) | (((x) & 0x00FF0000UL) >> 8UL) | \\r
-                                                          (((x) & 0x0000FF00UL) << 8UL)  | (((x) & 0x000000FFUL) << 24UL))\r
+                       #define SWAPENDIAN_32(x)            (uint32_t)((((x) & 0xFF000000UL) >> 24UL) | (((x) & 0x00FF0000UL) >> 8UL) | \\r
+                                                                      (((x) & 0x0000FF00UL) << 8UL)  | (((x) & 0x000000FFUL) << 24UL))\r
 \r
                        #if defined(ARCH_BIG_ENDIAN) && !defined(le16_to_cpu)\r
                                #define le16_to_cpu(x)           SwapEndian_16(x)\r
                                }\r
                        }\r
 \r
+       /* Disable C linkage for C++ Compilers: */\r
+               #if defined(__cplusplus)\r
+                       }\r
+               #endif\r
+\r
 #endif\r
 \r
 /** @} */\r