chiark / gitweb /
Allow float and double to be configured out, as they don't seem to speed things up...
authorRoss Younger <onyx-commits@impropriety.org.uk>
Sun, 27 Jan 2013 05:24:12 +0000 (18:24 +1300)
committerRoss Younger <onyx-commits@impropriety.org.uk>
Sun, 27 Jan 2013 05:29:38 +0000 (18:29 +1300)
configure.ac
libfractal/Fractal.h

index 13c65bb..dccb25f 100644 (file)
@@ -30,6 +30,37 @@ PKG_CHECK_MODULES([brot2gui],[glibmm-2.4 gtkmm-2.4 gdkmm-2.4 pangocairo cairo pa
 GTEST_SRC_CHECK
 VALGRIND_CHECK
 
+case $host_cpu in
+  x86_64 )
+       default_float=no
+       default_double=no
+       ;;
+  *)
+       default_float=yes
+       default_double=yes
+       # Argh, the epsilon values are likely wrong :-/
+       ;;
+esac
+
+AC_ARG_ENABLE([float],
+       [AS_HELP_STRING([--enable-float],
+               [Enable use of the `float' type.])],
+       [enable_float=${enableval}],
+       [enable_float=${default_float}])
+
+AC_ARG_ENABLE([double],
+       [AS_HELP_STRING([--enable-double],
+               [Enable use of the `double' type.])],
+       [enable_double=${enableval}],
+       [enable_double=${default_double}])
+
+if test "x$enable_float" != xno; then
+       AC_DEFINE([ENABLE_FLOAT], [1], [enable use of the `float' type])
+fi
+if test "x$enable_double" != xno; then
+       AC_DEFINE([ENABLE_DOUBLE], [1], [enable use of the `double' type])
+fi
+
 AC_SUBST([BROT2_CFLAGS], [${pkg_cflags}])
 AC_SUBST([BROT2_CXXFLAGS], [${pkg_cxxflags}])
 
index 8f83955..6f5a318 100644 (file)
@@ -24,6 +24,7 @@
 #include <map>
 #include <iostream>
 #include "Registry.h"
+#include "config.h"
 
 namespace Fractal {
 
@@ -40,12 +41,24 @@ void load_Misc();
 typedef long double Value; // short for "fractal value"
 typedef std::complex<Value> Point; // "complex fractal point"
 
+#ifdef ENABLE_DOUBLE
+#define MAYBE_DO_DOUBLE(_DO) _DO(double,Double,0.00000000000000044408920985006L /* 4.44e-16 */)
+#else
+#define MAYBE_DO_DOUBLE(_DO)
+#endif
+
+#ifdef ENABLE_FLOAT
+#define MAYBE_DO_FLOAT(_DO) _DO(float, Float, 0.0000002384185791016)
+#else
+#define MAYBE_DO_FLOAT(_DO)
+#endif
+
 // Master list of all maths types we know about.
 // Format: _DO(type name, enum name, minimum pixel size)
-#define ALL_MATHS_TYPES(_DO) \
-       _DO(double,Double,0.00000000000000044408920985006L /* 4.44e-16 */)                              \
+#define ALL_MATHS_TYPES(_DO)   \
+       MAYBE_DO_FLOAT(_DO)             \
+       MAYBE_DO_DOUBLE(_DO)            \
        _DO(long double, LongDouble, 0.0000000000000000002168404345L /* 2.16e-19 */)    \
-       _DO(float, Float, 0.0000002384185791016)                                                                                \
 
 
 class Maths {