Browse Source

Merge commit '0cd0a01' into bfgminer

Luke Dashjr 12 years ago
parent
commit
e54944a298
2 changed files with 6 additions and 2 deletions
  1. 2 2
      configure.ac
  2. 4 0
      miner.h

+ 2 - 2
configure.ac

@@ -563,12 +563,12 @@ LIBS="$LIBS -lm"
 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
 	#include <math.h>
 	#include <math.h>
 ]], [[
 ]], [[
-	return (roundl(0.5) == 1.0);
+	return (roundl(*(long double *)0xdeadbeef) == 1.0);
 ]])], [
 ]])], [
 	AC_MSG_RESULT([yes])
 	AC_MSG_RESULT([yes])
 ], [
 ], [
 	AC_MSG_RESULT([no])
 	AC_MSG_RESULT([no])
-	AC_DEFINE_UNQUOTED([roundl(x)], [(long double)((long long)((x==0)?0.0:((x)+(((x)>0)?0.5:-0.5))))], [Round to nearest integer, away from zero])
+	AC_DEFINE([NEED_ROUNDL], [1], [Defined to 1 if C99 roundl is missing])
 ])
 ])
 LIBS="${save_LIBS}"
 LIBS="${save_LIBS}"
 
 

+ 4 - 0
miner.h

@@ -190,6 +190,10 @@ static inline int fsync (int fd)
 #	endif
 #	endif
 #endif
 #endif
 
 
+#ifdef NEED_ROUNDL
+#define roundl(x)   (long double)((long long)((x==0)?0.0:((x)+(((x)>0)?0.5:-0.5))))
+#endif
+
 enum alive {
 enum alive {
 	LIFE_WELL,
 	LIFE_WELL,
 	LIFE_SICK,
 	LIFE_SICK,