[PATCH 1/4] comctl32/edit: Get rid of useless float cast

Gabriel Ivăncescu gabrielopcode at gmail.com
Tue Aug 21 15:33:08 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/edit.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/dlls/comctl32/edit.c b/dlls/comctl32/edit.c
index 10ff5fb..7bcf9ce 100644
--- a/dlls/comctl32/edit.c
+++ b/dlls/comctl32/edit.c
@@ -4911,7 +4911,7 @@ static LRESULT CALLBACK EDIT_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR
 
     case WM_MOUSEWHEEL:
     {
-        int wheelDelta;
+        INT wheelDelta;
         UINT pulScrollLines = 3;
         SystemParametersInfoW(SPI_GETWHEELSCROLLLINES,0, &pulScrollLines, 0);
 
@@ -4931,10 +4931,10 @@ static LRESULT CALLBACK EDIT_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR
 
         if (es->wheelDeltaRemainder && pulScrollLines)
         {
-            int cLineScroll;
-            pulScrollLines = (int) min((UINT) es->line_count, pulScrollLines);
-            cLineScroll = pulScrollLines * (float)es->wheelDeltaRemainder / WHEEL_DELTA;
-            es->wheelDeltaRemainder -= WHEEL_DELTA * cLineScroll / (int)pulScrollLines;
+            INT cLineScroll;
+            pulScrollLines = (INT) min((UINT) es->line_count, pulScrollLines);
+            cLineScroll = ((INT)pulScrollLines * es->wheelDeltaRemainder) / WHEEL_DELTA;
+            es->wheelDeltaRemainder -= (cLineScroll * WHEEL_DELTA) / (INT)pulScrollLines;
             result = EDIT_EM_LineScroll(es, 0, -cLineScroll);
         }
         break;
-- 
1.9.1




More information about the wine-devel mailing list