[PATCH 3/4] comctl32/listview: Get rid of useless float cast

Gabriel Iv─âncescu gabrielopcode at gmail.com
Tue Aug 21 15:33:10 CDT 2018


Since the division (the only operation with a fractional result) was
immediately truncated to integer anyway, the float cast is completely
useless. This works fine because the multiplication is done before the
division (parentheses have been added to emphasize this point).

Signed-off-by: Gabriel Iv─âncescu <gabrielopcode at gmail.com>
---
 dlls/comctl32/listview.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c
index 200bf93..d66a90c 100644
--- a/dlls/comctl32/listview.c
+++ b/dlls/comctl32/listview.c
@@ -9920,10 +9920,10 @@ static LRESULT LISTVIEW_MouseWheel(LISTVIEW_INFO *infoPtr, INT wheelDelta)
             infoPtr->cWheelRemainder = wheelDelta;
         if (infoPtr->cWheelRemainder && pulScrollLines)
         {
-            int cLineScroll;
+            INT cLineScroll;
             pulScrollLines = min((UINT)LISTVIEW_GetCountPerColumn(infoPtr), pulScrollLines);
-            cLineScroll = pulScrollLines * (float)infoPtr->cWheelRemainder / WHEEL_DELTA;
-            infoPtr->cWheelRemainder -= WHEEL_DELTA * cLineScroll / (int)pulScrollLines;
+            cLineScroll = ((INT)pulScrollLines * infoPtr->cWheelRemainder) / WHEEL_DELTA;
+            infoPtr->cWheelRemainder -= (cLineScroll * WHEEL_DELTA) / (INT)pulScrollLines;
             LISTVIEW_VScroll(infoPtr, SB_INTERNAL, -cLineScroll);
         }
         break;
-- 
1.9.1




More information about the wine-devel mailing list