From cd40797a4df6d53cc932ba10bdcf88b321e29ed2 Mon Sep 17 00:00:00 2001
From: Dean Camera <dean@fourwalledcubicle.com>
Date: Wed, 12 Sep 2012 17:23:53 +0000
Subject: [PATCH] Fixed possible rounding in the VERSION_BCD() macros for some
 0.01 step increments (thanks to Oliver Zander).

---
 LUFA/DoxygenPages/ChangeLog.txt        | 1 +
 LUFA/Drivers/USB/Core/StdDescriptors.h | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/LUFA/DoxygenPages/ChangeLog.txt b/LUFA/DoxygenPages/ChangeLog.txt
index 0b351550e..dfc6af612 100644
--- a/LUFA/DoxygenPages/ChangeLog.txt
+++ b/LUFA/DoxygenPages/ChangeLog.txt
@@ -29,6 +29,7 @@
   *   - Fixed missing Win-32bit compatibility sections in the LUFA INF driver files (thanks to Christan Beharrell)
   *   - Fixed logic hole breaking USB operations on a USB controller with only one supported USB mode and no USB_DEVICE_ONLY or USB_HOST_ONLY
   *     configuration token set
+  *   - Fixed possible rounding in the VERSION_BCD() macros for some 0.01 step increments (thanks to Oliver Zander)
   *  - Library Applications:
   *   - Fixed broken RESET_TOGGLES_LIBUSB_COMPAT compile time option in the AVRISP-MKII project
   *   - Fixed incompatibility in the CDC class bootloader on some systems (thanks to Sylvain Munaut)
diff --git a/LUFA/Drivers/USB/Core/StdDescriptors.h b/LUFA/Drivers/USB/Core/StdDescriptors.h
index 031e01d28..1056f0f96 100644
--- a/LUFA/Drivers/USB/Core/StdDescriptors.h
+++ b/LUFA/Drivers/USB/Core/StdDescriptors.h
@@ -724,8 +724,8 @@
 		/* Macros: */
 			#define VERSION_TENS(x)                   (int)((int)(x) / 10)
 			#define VERSION_ONES(x)                   (int)((int)(x) % 10)
-			#define VERSION_TENTHS(x)                 (int)(((x *  1) - ((int)(x *  1))) * 10)
-			#define VERSION_HUNDREDTHS(x)             (int)(((x * 10) - ((int)(x * 10))) * 10)
+			#define VERSION_TENTHS(x)                 (int)((x - (int)x) * 10)
+			#define VERSION_HUNDREDTHS(x)             (int)((x * 100) - ((int)(x * 10) * 10))
 	#endif
 
 	/* Disable C linkage for C++ Compilers: */
-- 
GitLab