[devel] Fixed non-GCC fixed point builds. In png.c a declaration was misplaced

in an earlier update.  Fixed to declare the auto variables at the head.
This commit is contained in:
Glenn Randers-Pehrson 2010-08-19 08:06:12 -05:00
parent 67439c4701
commit 3b5d695583
3 changed files with 8 additions and 3 deletions

View File

@ -358,6 +358,8 @@ version 1.5.0beta43 [August 11, 2010]
Made changes to address various issues identified by GCC, mostly
signed/unsigned and shortening problems on assignment but also a few
difficult to optimize (for GCC) loops.
Fixed non-GCC fixed point builds. In png.c a declaration was misplaced
in an earlier update. Fixed to declare the auto variables at the head.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net:
(subscription required; visit

View File

@ -2994,6 +2994,8 @@ Version 1.5.0beta43 [August 11, 2010]
Made changes to address various issues identified by GCC, mostly
signed/unsigned and shortening problems on assignment but also a few
difficult to optimize (for GCC) loops.
Fixed non-GCC fixed point builds. In png.c a declaration was misplaced
in an earlier update. Fixed to declare the auto variables at the head.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit

7
png.c
View File

@ -1509,6 +1509,7 @@ png_muldiv(png_fixed_point_p res, png_fixed_point a, png_int_32 times,
#else
int negative = 0;
png_uint_32 A, T, D;
png_uint_32 s16, s32, s00;
if (a < 0)
negative = 1, A = -a;
@ -1528,13 +1529,13 @@ png_muldiv(png_fixed_point_p res, png_fixed_point a, png_int_32 times,
/* Following can't overflow because the arguments only
* have 31 bits each, however the result may be 32 bits.
*/
png_uint_32 s16 = (A >> 16) * (T & 0xffff) +
s16 = (A >> 16) * (T & 0xffff) +
(A & 0xffff) * (T >> 16);
/* Can't overflow because the a*times bit is only 30
* bits at most.
*/
png_uint_32 s32 = (A >> 16) * (T >> 16) + (s16 >> 16);
png_uint_32 s00 = (A & 0xffff) * (T & 0xffff);
s32 = (A >> 16) * (T >> 16) + (s16 >> 16);
s00 = (A & 0xffff) * (T & 0xffff);
s16 = (s16 & 0xffff) << 16;
s00 += s16;