Commit 300458eb949f71a486710b69bb6b704139765b26

Alexei Podtelezhnikov 2019-05-03T23:16:42

Miscellaneous macro updates. * src/base/ftoutln.c (SCALED): Updated. * src/smooth/ftgrays.c (SCALED): Ditto. (FLOOR, ROUND, CEILING): Removed. * src/psaux/psfixed.h (cf2_fracToFixed): Updated.

diff --git a/ChangeLog b/ChangeLog
index 172e165..56db60a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2019-05-03  Alexei Podtelezhnikov  <apodtele@gmail.com>
+
+	Miscellaneous macro updates.
+
+	* src/base/ftoutln.c (SCALED): Updated.
+	* src/smooth/ftgrays.c (SCALED): Ditto.
+	(FLOOR, ROUND, CEILING): Removed.
+	* src/psaux/psfixed.h (cf2_fracToFixed): Updated.
+
 2019-05-02  Alexei Podtelezhnikov  <apodtele@gmail.com>
 
 	Tweak LCD filtering.
diff --git a/src/base/ftoutln.c b/src/base/ftoutln.c
index 86fa1c2..0e2ba34 100644
--- a/src/base/ftoutln.c
+++ b/src/base/ftoutln.c
@@ -46,8 +46,7 @@
                         void*                    user )
   {
 #undef  SCALED
-#define SCALED( x )  ( ( (x) < 0 ? -( -(x) << shift )             \
-                                 :  (  (x) << shift ) ) - delta )
+#define SCALED( x )  ( (x) * ( 1L << shift ) - delta )
 
     FT_Vector   v_last;
     FT_Vector   v_control;
diff --git a/src/psaux/psfixed.h b/src/psaux/psfixed.h
index fd3460f..7dff9ef 100644
--- a/src/psaux/psfixed.h
+++ b/src/psaux/psfixed.h
@@ -72,8 +72,7 @@ FT_BEGIN_HEADER
 #define cf2_fixedFraction( x )                                           \
           ( (x) - cf2_fixedFloor( x ) )
 #define cf2_fracToFixed( x )                                             \
-          ( (x) < 0 ? -( ( -(x) + 0x2000 ) >> 14 )                       \
-                    :  ( (  (x) + 0x2000 ) >> 14 ) )
+          ( ( (x) + 0x2000 - ( (x) < 0 ) ) >> 14 )
 
 
   /* signed numeric types */
diff --git a/src/smooth/ftgrays.c b/src/smooth/ftgrays.c
index 72ab546..e39f00b 100644
--- a/src/smooth/ftgrays.c
+++ b/src/smooth/ftgrays.c
@@ -327,17 +327,9 @@ typedef ptrdiff_t  FT_PtrDist;
   /* must be at least 6 bits! */
 #define PIXEL_BITS  8
 
-#undef FLOOR
-#undef CEILING
-#undef TRUNC
-#undef SCALED
-
 #define ONE_PIXEL       ( 1 << PIXEL_BITS )
 #define TRUNC( x )      ( (TCoord)( (x) >> PIXEL_BITS ) )
 #define SUBPIXELS( x )  ( (TPos)(x) * ONE_PIXEL )
-#define FLOOR( x )      ( (x) & -ONE_PIXEL )
-#define CEILING( x )    ( ( (x) + ONE_PIXEL - 1 ) & -ONE_PIXEL )
-#define ROUND( x )      ( ( (x) + ONE_PIXEL / 2 ) & -ONE_PIXEL )
 
 #if PIXEL_BITS >= 6
 #define UPSCALE( x )    ( (x) * ( ONE_PIXEL >> 6 ) )
@@ -1337,7 +1329,7 @@ typedef ptrdiff_t  FT_PtrDist;
                         void*                    user )
   {
 #undef SCALED
-#define SCALED( x )  ( ( (x) << shift ) - delta )
+#define SCALED( x )  ( (x) * ( 1L << shift ) - delta )
 
     FT_Vector   v_last;
     FT_Vector   v_control;