2008-04-18 21:31:39 -03:00
|
|
|
#include "Python.h"
|
|
|
|
|
2009-04-16 16:52:09 -03:00
|
|
|
|
2021-10-11 18:09:40 -03:00
|
|
|
#ifdef HAVE_GCC_ASM_FOR_X87
|
|
|
|
// Inline assembly for getting and setting the 387 FPU control word on
|
|
|
|
// GCC/x86.
|
2018-11-13 02:01:22 -04:00
|
|
|
#ifdef _Py_MEMORY_SANITIZER
|
2018-11-12 16:07:14 -04:00
|
|
|
__attribute__((no_sanitize_memory))
|
|
|
|
#endif
|
2009-04-16 16:52:09 -03:00
|
|
|
unsigned short _Py_get_387controlword(void) {
|
|
|
|
unsigned short cw;
|
|
|
|
__asm__ __volatile__ ("fnstcw %0" : "=m" (cw));
|
|
|
|
return cw;
|
|
|
|
}
|
|
|
|
|
|
|
|
void _Py_set_387controlword(unsigned short cw) {
|
|
|
|
__asm__ __volatile__ ("fldcw %0" : : "m" (cw));
|
|
|
|
}
|
2021-10-11 18:09:40 -03:00
|
|
|
#endif // HAVE_GCC_ASM_FOR_X87
|