Skip to content

Commit 240b277

Browse files
authored
Use correct fp_env definition for OpenBSD (#4259)
This commit includes OpenBSD in the list of definitions checked when adding exceptions to the control flags of the floating point environment on OpenBSD. Similar to FreeBSD, the flags are contained in an x87 struct within the fp_env structure. For reference, the [official CVSWeb repository](https://cvsweb.openbsd.org/src/sys/arch/amd64/include/fenv.h?rev=1.4&content-type=text/x-cvsweb-markup) shows a definition of: ```c /* * fenv_t represents the entire floating-point environment. */ typedef struct { struct { unsigned int __control; /* Control word register */ unsigned int __status; /* Status word register */ unsigned int __tag; /* Tag word register */ unsigned int __others[4]; /* EIP, Pointer Selector, etc */ } __x87; unsigned int __mxcsr; /* Control, status register */ } fenv_t; ```
1 parent 28bf3b0 commit 240b277

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

ortools/util/fp_utils.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ class ScopedFloatingPointEnv {
8989
excepts &= FE_ALL_EXCEPT;
9090
#if defined(__APPLE__)
9191
fenv_.__control &= ~excepts;
92-
#elif defined(__FreeBSD__)
92+
#elif (defined(__FreeBSD__) || defined(__OpenBSD__))
9393
fenv_.__x87.__control &= ~excepts;
9494
#else // Linux
9595
fenv_.__control_word &= ~excepts;

0 commit comments

Comments
 (0)