From beaacb7821a0e71f5626d4e10e5347e88d190077 Mon Sep 17 00:00:00 2001 From: Glenn Randers-Pehrson Date: Mon, 17 Mar 2014 16:14:05 -0500 Subject: [PATCH] [libpng15] Removed #if/#else/#endif from inside two pow() calls in pngvalid.c because they were handled improperly by Portland Group's PGI-14.1 - PGI-14.3 when using its "__builtin_pow()" function. --- ANNOUNCE | 3 +++ CHANGES | 3 +++ contrib/libtests/pngvalid.c | 29 ++++++++++++++--------------- 3 files changed, 20 insertions(+), 15 deletions(-) diff --git a/ANNOUNCE b/ANNOUNCE index 38292ecad..be45f17d7 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -39,6 +39,9 @@ Version 1.5.19beta02 [March 17, 2014] Moved configuration information from the manual to the INSTALL file. Version 1.5.19beta03 [March 17, 2014] + Removed #if/#else/#endif from inside two pow() calls in pngvalid.c because + they were handled improperly by Portland Group's PGI-14.1 - PGI-14.3 + when using its "__builtin_pow()" function. Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/CHANGES b/CHANGES index 10fd1e407..ee6e395dd 100644 --- a/CHANGES +++ b/CHANGES @@ -4215,6 +4215,9 @@ Version 1.5.19beta02 [March 17, 2014] Moved configuration information from the manual to the INSTALL file. Version 1.5.19beta03 [March 17, 2014] + Removed #if/#else/#endif from inside two pow() calls in pngvalid.c because + they were handled improperly by Portland Group's PGI-14.1 - PGI-14.3 + when using its "__builtin_pow()" function. Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/contrib/libtests/pngvalid.c b/contrib/libtests/pngvalid.c index aa732333d..b15a6bcb4 100644 --- a/contrib/libtests/pngvalid.c +++ b/contrib/libtests/pngvalid.c @@ -6776,14 +6776,14 @@ image_transform_png_set_rgb_to_gray_ini(PNG_CONST image_transform *this, * conversion adds another +/-2 in the 16-bit case and * +/-(1<<(15-PNG_MAX_GAMMA_8)) in the 8-bit case. */ - that->pm->limit += pow( -# if PNG_MAX_GAMMA_8 < 14 - (that->this.bit_depth == 16 ? 8. : - 6. + (1<<(15-PNG_MAX_GAMMA_8))) -# else - 8. -# endif - /65535, data.gamma); + that->pm->limit += +# if PNG_MAX_GAMMA_8 < 14 + pow((that->this.bit_depth == 16 ? + 8. : 6. + (1<<(15-PNG_MAX_GAMMA_8)))/65535, data.gamma); +# else + pow((that->this.bit_depth == 16 ? + 8. : 8. + (1<<(15-PNG_MAX_GAMMA_8)))/65535, data.gamma); +# endif } else @@ -6801,13 +6801,12 @@ image_transform_png_set_rgb_to_gray_ini(PNG_CONST image_transform *this, * internal calculation errors, not the actual limit imposed by * pngvalid on the output errors. */ - that->pm->limit += pow( -# if DIGITIZE - 1.1 -# else - 1. -# endif - /255, data.gamma); + that->pm->limit += +# if DIGITIZE + pow(1.1 /255, data.gamma); +# else + pow(1.0 /255, data.gamma); +# endif } }