diff --git a/ChangeLog b/ChangeLog index 68baf19f9..a1db4ad70 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2016-03-06 Alexei Podtelezhnikov + + [smooth] Replace left shifts with multiplications (#47114). + + * src/smooth/ftgrays.c (SUBPIXELS, UPSCALE, DOWNSCALE): Do it. + 2016-03-05 Werner Lemberg [autofit] Avoid excessive stem length rounding (#25392). diff --git a/src/smooth/ftgrays.c b/src/smooth/ftgrays.c index d6d0e255b..e242ae7f6 100644 --- a/src/smooth/ftgrays.c +++ b/src/smooth/ftgrays.c @@ -320,17 +320,17 @@ typedef ptrdiff_t FT_PtrDist; #define ONE_PIXEL ( 1L << PIXEL_BITS ) #define TRUNC( x ) ( (TCoord)( (x) >> PIXEL_BITS ) ) -#define SUBPIXELS( x ) ( (TPos)(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) << ( PIXEL_BITS - 6 ) ) +#define UPSCALE( x ) ( (x) * ( ONE_PIXEL >> 6 ) ) #define DOWNSCALE( x ) ( (x) >> ( PIXEL_BITS - 6 ) ) #else #define UPSCALE( x ) ( (x) >> ( 6 - PIXEL_BITS ) ) -#define DOWNSCALE( x ) ( (x) << ( 6 - PIXEL_BITS ) ) +#define DOWNSCALE( x ) ( (x) * ( 64 >> PIXEL_BITS ) ) #endif