aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/tools/python3/src/Python/pymath.c
diff options
context:
space:
mode:
authornkozlovskiy <nmk@ydb.tech>2023-09-29 12:24:06 +0300
committernkozlovskiy <nmk@ydb.tech>2023-09-29 12:41:34 +0300
commite0e3e1717e3d33762ce61950504f9637a6e669ed (patch)
treebca3ff6939b10ed60c3d5c12439963a1146b9711 /contrib/tools/python3/src/Python/pymath.c
parent38f2c5852db84c7b4d83adfcb009eb61541d1ccd (diff)
downloadydb-e0e3e1717e3d33762ce61950504f9637a6e669ed.tar.gz
add ydb deps
Diffstat (limited to 'contrib/tools/python3/src/Python/pymath.c')
-rw-r--r--contrib/tools/python3/src/Python/pymath.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/contrib/tools/python3/src/Python/pymath.c b/contrib/tools/python3/src/Python/pymath.c
new file mode 100644
index 0000000000..e7d0161ff9
--- /dev/null
+++ b/contrib/tools/python3/src/Python/pymath.c
@@ -0,0 +1,19 @@
+#include "Python.h"
+
+
+#ifdef HAVE_GCC_ASM_FOR_X87
+// Inline assembly for getting and setting the 387 FPU control word on
+// GCC/x86.
+#ifdef _Py_MEMORY_SANITIZER
+__attribute__((no_sanitize_memory))
+#endif
+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));
+}
+#endif // HAVE_GCC_ASM_FOR_X87