[BACK]Return to patch-aa CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / pkgsrc / devel / libbinio / patches

File: [cvs.NetBSD.org] / pkgsrc / devel / libbinio / patches / patch-aa (download)

Revision 1.1, Sun Jan 13 22:42:07 2008 UTC (13 years, 10 months ago) by rillig
Branch: MAIN
CVS Tags: pkgsrc-2021Q3-base, pkgsrc-2021Q3, pkgsrc-2021Q2-base, pkgsrc-2021Q2, pkgsrc-2021Q1-base, pkgsrc-2021Q1, pkgsrc-2020Q4-base, pkgsrc-2020Q4, pkgsrc-2020Q3-base, pkgsrc-2020Q3, pkgsrc-2020Q2-base, pkgsrc-2020Q2, pkgsrc-2020Q1-base, pkgsrc-2020Q1, pkgsrc-2019Q4-base, pkgsrc-2019Q4, pkgsrc-2019Q3-base, pkgsrc-2019Q3, pkgsrc-2019Q2-base, pkgsrc-2019Q2, pkgsrc-2019Q1-base, pkgsrc-2019Q1, pkgsrc-2018Q4-base, pkgsrc-2018Q4, pkgsrc-2018Q3-base, pkgsrc-2018Q3, pkgsrc-2018Q2-base, pkgsrc-2018Q2, pkgsrc-2018Q1-base, pkgsrc-2018Q1, pkgsrc-2017Q4-base, pkgsrc-2017Q4, pkgsrc-2017Q3-base, pkgsrc-2017Q3, pkgsrc-2017Q2-base, pkgsrc-2017Q2, pkgsrc-2017Q1-base, pkgsrc-2017Q1, pkgsrc-2016Q4-base, pkgsrc-2016Q4, pkgsrc-2016Q3-base, pkgsrc-2016Q3, pkgsrc-2016Q2-base, pkgsrc-2016Q2, pkgsrc-2016Q1-base, pkgsrc-2016Q1, pkgsrc-2015Q4-base, pkgsrc-2015Q4, pkgsrc-2015Q3-base, pkgsrc-2015Q3, pkgsrc-2015Q2-base, pkgsrc-2015Q2, pkgsrc-2015Q1-base, pkgsrc-2015Q1, pkgsrc-2014Q4-base, pkgsrc-2014Q4, pkgsrc-2014Q3-base, pkgsrc-2014Q3, pkgsrc-2014Q2-base, pkgsrc-2014Q2, pkgsrc-2014Q1-base, pkgsrc-2014Q1, pkgsrc-2013Q4-base, pkgsrc-2013Q4, pkgsrc-2013Q3-base, pkgsrc-2013Q3, pkgsrc-2013Q2-base, pkgsrc-2013Q2, pkgsrc-2013Q1-base, pkgsrc-2013Q1, pkgsrc-2012Q4-base, pkgsrc-2012Q4, pkgsrc-2012Q3-base, pkgsrc-2012Q3, pkgsrc-2012Q2-base, pkgsrc-2012Q2, pkgsrc-2012Q1-base, pkgsrc-2012Q1, pkgsrc-2011Q4-base, pkgsrc-2011Q4, pkgsrc-2011Q3-base, pkgsrc-2011Q3, pkgsrc-2011Q2-base, pkgsrc-2011Q2, pkgsrc-2011Q1-base, pkgsrc-2011Q1, pkgsrc-2010Q4-base, pkgsrc-2010Q4, pkgsrc-2010Q3-base, pkgsrc-2010Q3, pkgsrc-2010Q2-base, pkgsrc-2010Q2, pkgsrc-2010Q1-base, pkgsrc-2010Q1, pkgsrc-2009Q4-base, pkgsrc-2009Q4, pkgsrc-2009Q3-base, pkgsrc-2009Q3, pkgsrc-2009Q2-base, pkgsrc-2009Q2, pkgsrc-2009Q1-base, pkgsrc-2009Q1, pkgsrc-2008Q4-base, pkgsrc-2008Q4, pkgsrc-2008Q3-base, pkgsrc-2008Q3, pkgsrc-2008Q2-base, pkgsrc-2008Q2, pkgsrc-2008Q1-base, pkgsrc-2008Q1, cwrapper, cube-native-xorg-base, cube-native-xorg, HEAD

Added a patch for sunpro.

$NetBSD: patch-aa,v 1.1 2008/01/13 22:42:07 rillig Exp $

Sun Studio C++ is very picky about the correct prototypes. It doesn't
resolve pow(int, int) to one of pow(double, int) and pow(long double,
int). It also cannot decide for pow(double, unsigned int) whether it
should be pow(double, int) (which _might_ invoke undefined behavior)
and pow(double, double).

--- src/binio.cpp.orig	2004-08-18 21:41:20.000000000 +0200
+++ src/binio.cpp	2007-12-05 18:16:12.361936000 +0100
@@ -215,9 +215,9 @@ binistream::Float binistream::ieee_singl
     }
 
   if(!exp)	// Unnormalized float values
-    return sign * pow(2, -126) * fract * pow(2, -23);
+    return sign * pow(2.0, -126) * fract * pow(2.0, -23);
   else		// Normalized float values
-    return sign * pow(2, exp - 127) * (fract * pow(2, -23) + 1);
+    return sign * pow(2.0, int(exp - 127)) * (fract * pow(2.0, -23) + 1);
 
   err |= Fatal; return 0.0;
 }
@@ -227,9 +227,9 @@ binistream::Float binistream::ieee_doubl
   signed int	sign = data[0] >> 7 ? -1 : 1;
   unsigned int	exp = ((unsigned int)(data[0] & 0x7f) << 4) | (data[1] >> 4),
     fracthi4 = data[1] & 0xf;
-  Float		fract = fracthi4 * pow(2, 48) + data[2] * pow(2, 40) + data[3] *
-    pow(2, 32) + data[4] * pow(2, 24) + data[5] * pow(2, 16) + data[6] *
-    pow(2, 8) + data[7];
+  Float		fract = fracthi4 * pow(2.0, 48) + data[2] * pow(2.0, 40) + data[3] *
+    pow(2.0, 32) + data[4] * pow(2.0, 24) + data[5] * pow(2.0, 16) + data[6] *
+    pow(2.0, 8) + data[7];
 
   // Signed and unsigned zero
   if(!exp && !fracthi4 && !data[2] && !data[3] && !data[4] && !data[5] &&
@@ -254,9 +254,9 @@ binistream::Float binistream::ieee_doubl
     }
 
   if(!exp)	// Unnormalized float values
-    return sign * pow(2, -1022) * fract * pow(2, -52);
+    return sign * pow(2.0, -1022) * fract * pow(2.0, -52);
   else		// Normalized float values
-    return sign * pow(2, exp - 1023) * (fract * pow(2, -52) + 1);
+    return sign * pow(2.0, int(exp - 1023)) * (fract * pow(2.0, -52) + 1);
 
   err |= Fatal; return 0.0;
 }