Speed up bit-banged USART code in the AVRISP project.
[pub/USBasp.git] / LUFA / Drivers / USB / HighLevel / StdDescriptors.h
index 0b56ab6..9b46c09 100644 (file)
@@ -43,6 +43,7 @@
        /* Includes: */\r
                #include <avr/pgmspace.h>\r
                #include <stdbool.h>\r
+               #include <stddef.h>\r
 \r
                #include "../../../Common/Common.h"\r
                #include "USBMode.h"\r
@@ -72,7 +73,7 @@
                                 *  a unique serial number internally, and setting the device descriptors serial number string index to this value\r
                                 *  will cause it to use the internal serial number.\r
                                 *\r
-                                *  On unsupported devices, this will evaluate to NO_DESCRIPTOR and so will force the host to create a pseduo-serial\r
+                                *  On unsupported devices, this will evaluate to NO_DESCRIPTOR and so will force the host to create a pseudo-serial\r
                                 *  number for the device.\r
                                 */\r
                                #define USE_INTERNAL_SERIAL           0xDC\r
                        #endif\r
                        \r
                        /** Macro to calculate the power value for the device descriptor, from a given number of milliamps. */\r
-                       #define USB_CONFIG_POWER_MA(mA)           (mA >> 1)\r
+                       #define USB_CONFIG_POWER_MA(mA)           ((mA) >> 1)\r
 \r
                        /** Macro to calculate the Unicode length of a string with a given number of Unicode characters.\r
                         *  Should be used in string descriptor's headers for giving the string descriptor's byte length.\r
                         */\r
-                       #define USB_STRING_LEN(str)               (sizeof(USB_Descriptor_Header_t) + (str << 1))\r
+                       #define USB_STRING_LEN(str)               (sizeof(USB_Descriptor_Header_t) + ((str) << 1))\r
                        \r
                        /** Macro to encode a given four digit floating point version number (e.g. 01.23) into Binary Coded\r
                         *  Decimal format for descriptor fields requiring BCD encoding, such as the USB version number in the\r
                        {\r
                                USB_Descriptor_Header_t Header; /**< Descriptor header, including type and size. */\r
                                \r
-                               int16_t     UnicodeString[]; /**< String data, as unicode characters (alternatively,\r
-                                                             *   string language IDs). If normal ASCII characters are\r
-                                                             *   to be used, they must be added as an array of characters\r
-                                                             *   rather than a normal C string so that they are widened to\r
-                                                             *   Unicode size.\r
-                                                             *\r
-                                                             *   Under GCC, strings prefixed with the "L" character (before\r
-                                                             *   the opening string quotation mark) are considered to be\r
-                                                             *   Unicode strings, and may be used instead of an explicit\r
-                                                             *   array of ASCII characters.\r
-                                                             */\r
+                               wchar_t UnicodeString[];  /**< String data, as unicode characters (alternatively,\r
+                                                          *   string language IDs). If normal ASCII characters are\r
+                                                          *   to be used, they must be added as an array of characters\r
+                                                          *   rather than a normal C string so that they are widened to\r
+                                                          *   Unicode size.\r
+                                                          *\r
+                                                          *   Under GCC, strings prefixed with the "L" character (before\r
+                                                          *   the opening string quotation mark) are considered to be\r
+                                                          *   Unicode strings, and may be used instead of an explicit\r
+                                                          *   array of ASCII characters.\r
+                                                          */\r
                        } USB_Descriptor_String_t;\r
 \r
                        /** Type define for a standard string descriptor. Unlike other standard descriptors, the length\r
        /* Private Interface - For use in library only: */\r
        #if !defined(__DOXYGEN__)\r
                /* Macros: */\r
-                       #define VERSION_TENS(x)                   (int)(x / 10)\r
-                       #define VERSION_ONES(x)                   (int)(x - (10 * VERSION_TENS(x)))\r
-                       #define VERSION_TENTHS(x)                 (int)((x - (int)x) * 10)\r
-                       #define VERSION_HUNDREDTHS(x)             (int)(((x - (int)x) * 100) - (10 * VERSION_TENTHS(x)))\r
+                       #define VERSION_TENS(x)                   (int)((x) / 10)\r
+                       #define VERSION_ONES(x)                   (int)((x) - (10 * VERSION_TENS(x)))\r
+                       #define VERSION_TENTHS(x)                 (int)(((x) - (int)(x)) * 10)\r
+                       #define VERSION_HUNDREDTHS(x)             (int)((((x) - (int)(x)) * 100) - (10 * VERSION_TENTHS(x)))\r
        #endif\r
        \r
        /* Disable C linkage for C++ Compilers: */\r