[poppler] splash/SplashMath.h

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Jul 20 16:40:36 UTC 2020


 splash/SplashMath.h |   40 +++++++++++++++++++++++++++++++---------
 1 file changed, 31 insertions(+), 9 deletions(-)

New commits:
commit 3a9bfd6ef981692b391e63c32725c12817a2d08f
Author: Jean Ghali <jghali at libertysurf.fr>
Date:   Mon Jul 20 18:34:30 2020 +0200

    Fix x86 + windows asm
    
    It broke during the clang-reformat

diff --git a/splash/SplashMath.h b/splash/SplashMath.h
index cf034acb..776e212c 100644
--- a/splash/SplashMath.h
+++ b/splash/SplashMath.h
@@ -13,6 +13,7 @@
 //
 // Copyright (C) 2009-2011 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2017 Adrian Johnson <ajohnson at redneon.com>
+// Copyright (C) 2020 Jean Ghali <jghali at libertysurf.fr>
 //
 // To see a description of the changes please see the Changelog file that
 // came with your tarball or type make ChangeLog if you are building from git
@@ -66,9 +67,16 @@ static inline int splashFloor(SplashCoord x)
     unsigned short oldCW, newCW;
     int result;
 
-    __asm fld QWORD PTR x __asm fnstcw WORD PTR oldCW __asm mov ax, WORD PTR oldCW __asm and ax, 0xf3ff __asm or ax, 0x0400 __asm mov WORD PTR newCW,
-            ax // round down
-            __asm fldcw WORD PTR newCW __asm fistp DWORD PTR result __asm fldcw WORD PTR oldCW return result;
+    __asm fld QWORD PTR x;
+    __asm fnstcw WORD PTR oldCW;
+    __asm mov ax, WORD PTR oldCW;
+    __asm and ax, 0xf3ff;
+    __asm or ax, 0x0400;
+    __asm mov WORD PTR newCW, ax; // round down
+    __asm fldcw WORD PTR newCW;
+    __asm fistp DWORD PTR result;
+    __asm fldcw WORD PTR oldCW;
+    return result;
 #else
     if (x > 0)
         return (int)x;
@@ -107,9 +115,16 @@ static inline int splashCeil(SplashCoord x)
     unsigned short oldCW, newCW;
     int result;
 
-    __asm fld QWORD PTR x __asm fnstcw WORD PTR oldCW __asm mov ax, WORD PTR oldCW __asm and ax, 0xf3ff __asm or ax, 0x0800 __asm mov WORD PTR newCW,
-            ax // round up
-            __asm fldcw WORD PTR newCW __asm fistp DWORD PTR result __asm fldcw WORD PTR oldCW return result;
+    __asm fld QWORD PTR x;
+    __asm fnstcw WORD PTR oldCW;
+    __asm mov ax, WORD PTR oldCW;
+    __asm and ax, 0xf3ff;
+    __asm or ax, 0x0800;
+    __asm mov WORD PTR newCW, ax; // round up
+    __asm fldcw WORD PTR newCW;
+    __asm fistp DWORD PTR result;
+    __asm fldcw WORD PTR oldCW;
+    return result;
 #else
     return (int)ceil(x);
 #endif
@@ -145,9 +160,16 @@ static inline int splashRound(SplashCoord x)
     int result;
 
     x += 0.5;
-    __asm fld QWORD PTR x __asm fnstcw WORD PTR oldCW __asm mov ax, WORD PTR oldCW __asm and ax, 0xf3ff __asm or ax, 0x0400 __asm mov WORD PTR newCW,
-            ax // round down
-            __asm fldcw WORD PTR newCW __asm fistp DWORD PTR result __asm fldcw WORD PTR oldCW return result;
+    __asm fld QWORD PTR x;
+    __asm fnstcw WORD PTR oldCW;
+    __asm mov ax, WORD PTR oldCW;
+    __asm and ax, 0xf3ff;
+    __asm or ax, 0x0400;
+    __asm mov WORD PTR newCW, ax; // round down
+    __asm fldcw WORD PTR newCW;
+    __asm fistp DWORD PTR result;
+    __asm fldcw WORD PTR oldCW;
+    return result;
 #else
     return (int)splashFloor(x + 0.5);
 #endif


More information about the poppler mailing list