nixpkgs/pkgs/applications/science/logic/avy/minisat-fenv.patch

58 lines
2.1 KiB
Diff
Raw Normal View History

2017-10-18 02:08:48 +00:00
diff --git a/core/Main.cc b/core/Main.cc
2022-11-01 16:17:55 +00:00
index 2b0d97b..9ba985d 100644
2017-10-18 02:08:48 +00:00
--- a/core/Main.cc
+++ b/core/Main.cc
2022-11-01 16:17:55 +00:00
@@ -77,9 +77,13 @@ int main(int argc, char** argv)
setUsageHelp("USAGE: %s [options] <input-file> <result-output-file>\n\n where input may be either in plain or gzipped DIMACS.\n");
2017-10-18 02:08:48 +00:00
// printf("This is MiniSat 2.0 beta\n");
2022-11-01 16:17:55 +00:00
-#if defined(__linux__)
2017-10-18 02:08:48 +00:00
- fpu_control_t oldcw, newcw;
- _FPU_GETCW(oldcw); newcw = (oldcw & ~_FPU_EXTENDED) | _FPU_DOUBLE; _FPU_SETCW(newcw);
2022-11-01 16:17:55 +00:00
+#if defined(__linux__) && defined(__x86_64__)
2017-10-18 02:08:48 +00:00
+ fenv_t fenv;
+
+ fegetenv(&fenv);
+ fenv.__control_word &= ~0x300; /* _FPU_EXTENDED */
+ fenv.__control_word |= 0x200; /* _FPU_DOUBLE */
+ fesetenv(&fenv);
printf("WARNING: for repeatability, setting FPU to use double precision\n");
#endif
// Extra options:
diff --git a/simp/Main.cc b/simp/Main.cc
2022-11-01 16:17:55 +00:00
index 2804d7f..7fbdb33 100644
2017-10-18 02:08:48 +00:00
--- a/simp/Main.cc
+++ b/simp/Main.cc
2022-11-01 16:17:55 +00:00
@@ -78,9 +78,13 @@ int main(int argc, char** argv)
setUsageHelp("USAGE: %s [options] <input-file> <result-output-file>\n\n where input may be either in plain or gzipped DIMACS.\n");
2017-10-18 02:08:48 +00:00
// printf("This is MiniSat 2.0 beta\n");
2022-11-01 16:17:55 +00:00
-#if defined(__linux__)
2017-10-18 02:08:48 +00:00
- fpu_control_t oldcw, newcw;
- _FPU_GETCW(oldcw); newcw = (oldcw & ~_FPU_EXTENDED) | _FPU_DOUBLE; _FPU_SETCW(newcw);
2022-11-01 16:17:55 +00:00
+#if defined(__linux__) && defined(__x86_64__)
2017-10-18 02:08:48 +00:00
+ fenv_t fenv;
+
+ fegetenv(&fenv);
+ fenv.__control_word &= ~0x300; /* _FPU_EXTENDED */
+ fenv.__control_word |= 0x200; /* _FPU_DOUBLE */
+ fesetenv(&fenv);
printf("WARNING: for repeatability, setting FPU to use double precision\n");
#endif
// Extra options:
diff --git a/utils/System.h b/utils/System.h
2022-11-01 16:17:55 +00:00
index 1758192..840bee5 100644
2017-10-18 02:08:48 +00:00
--- a/utils/System.h
+++ b/utils/System.h
2022-11-01 16:17:55 +00:00
@@ -21,8 +21,8 @@ OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWA
#ifndef Minisat_System_h
2017-10-18 02:08:48 +00:00
#define Minisat_System_h
2022-11-01 16:17:55 +00:00
-#if defined(__linux__)
2017-10-18 02:08:48 +00:00
-#include <fpu_control.h>
2022-11-01 16:17:55 +00:00
+#if defined(__linux__) && defined(__x86_64__)
2017-10-18 02:08:48 +00:00
+#include <fenv.h>
#endif
#include "mtl/IntTypes.h"