Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 57 lines 2.1 kB view raw
1diff --git a/core/Main.cc b/core/Main.cc 2index fd8fca1..37d2ed5 100644 3--- a/core/Main.cc 4+++ b/core/Main.cc 5@@ -95,9 +95,13 @@ int main(int argc, char** argv) 6 setUsageHelp("c USAGE: %s [options] <input-file> <result-output-file>\n\n where input may be either in plain or gzipped DIMACS.\n"); 7 // printf("This is MiniSat 2.0 beta\n"); 8 9-#if defined(__linux__) 10- fpu_control_t oldcw, newcw; 11- _FPU_GETCW(oldcw); newcw = (oldcw & ~_FPU_EXTENDED) | _FPU_DOUBLE; _FPU_SETCW(newcw); 12+#if defined(__linux__) && defined(__x86_64__) 13+ fenv_t fenv; 14+ 15+ fegetenv(&fenv); 16+ fenv.__control_word &= ~0x300; /* _FPU_EXTENDED */ 17+ fenv.__control_word |= 0x200; /* _FPU_DOUBLE */ 18+ fesetenv(&fenv); 19 printf("c WARNING: for repeatability, setting FPU to use double precision\n"); 20 #endif 21 // Extra options: 22diff --git a/simp/Main.cc b/simp/Main.cc 23index 4f4772d..c605f6e 100644 24--- a/simp/Main.cc 25+++ b/simp/Main.cc 26@@ -96,9 +96,13 @@ int main(int argc, char** argv) 27 setUsageHelp("c USAGE: %s [options] <input-file> <result-output-file>\n\n where input may be either in plain or gzipped DIMACS.\n"); 28 29 30-#if defined(__linux__) 31- fpu_control_t oldcw, newcw; 32- _FPU_GETCW(oldcw); newcw = (oldcw & ~_FPU_EXTENDED) | _FPU_DOUBLE; _FPU_SETCW(newcw); 33+#if defined(__linux__) && defined(__x86_64__) 34+ fenv_t fenv; 35+ 36+ fegetenv(&fenv); 37+ fenv.__control_word &= ~0x300; /* _FPU_EXTENDED */ 38+ fenv.__control_word |= 0x200; /* _FPU_DOUBLE */ 39+ fesetenv(&fenv); 40 printf("WARNING: for repeatability, setting FPU to use double precision\n"); 41 #endif 42 // Extra options: 43diff --git a/utils/System.h b/utils/System.h 44index 004d498..2f6d922 100644 45--- a/utils/System.h 46+++ b/utils/System.h 47@@ -21,8 +21,8 @@ OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWA 48 #ifndef Glucose_System_h 49 #define Glucose_System_h 50 51-#if defined(__linux__) 52-#include <fpu_control.h> 53+#if defined(__linux__) && defined(__x86_64__) 54+#include <fenv.h> 55 #endif 56 57 #include "glucose/mtl/IntTypes.h"