diff options
author | suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp> | 2009-08-01 00:30:24 +0900 |
---|---|---|
committer | suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp> | 2009-08-01 00:30:24 +0900 |
commit | 0d226c31c5f3ba8e3eb2cd5a86e5137d25c4cc64 (patch) | |
tree | c556e5072a17fad835878de346eabcef1c41abf0 /src/base/fttrigon.c | |
parent | 072e55233e46b9d576bf5440da09ae2f08c5755d (diff) |
base: Prevent some overflows on LP64 systems.
Diffstat (limited to 'src/base/fttrigon.c')
-rw-r--r-- | src/base/fttrigon.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/base/fttrigon.c b/src/base/fttrigon.c index 9f513946..fdf433ab 100644 --- a/src/base/fttrigon.c +++ b/src/base/fttrigon.c @@ -72,10 +72,10 @@ val = ( val >= 0 ) ? val : -val; v1 = (FT_UInt32)val >> 16; - v2 = (FT_UInt32)val & 0xFFFFL; + v2 = (FT_UInt32)(val & 0xFFFFL); - k1 = FT_TRIG_SCALE >> 16; /* constant */ - k2 = FT_TRIG_SCALE & 0xFFFFL; /* constant */ + k1 = (FT_UInt32)FT_TRIG_SCALE >> 16; /* constant */ + k2 = (FT_UInt32)(FT_TRIG_SCALE & 0xFFFFL); /* constant */ hi = k1 * v1; lo1 = k1 * v2 + k2 * v1; /* can't overflow */ @@ -86,7 +86,7 @@ hi += lo1 >> 16; if ( lo1 < lo3 ) - hi += 0x10000UL; + hi += (FT_UInt32)0x10000UL; val = (FT_Fixed)hi; @@ -433,7 +433,7 @@ if ( shift > 0 ) { - FT_Int32 half = 1L << ( shift - 1 ); + FT_Int32 half = (FT_Int32)1L << ( shift - 1 ); vec->x = ( v.x + half + FT_SIGN_LONG( v.x ) ) >> shift; |