summaryrefslogtreecommitdiff
path: root/lib/fpucw.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/fpucw.h')
-rw-r--r--lib/fpucw.h35
1 files changed, 13 insertions, 22 deletions
diff --git a/lib/fpucw.h b/lib/fpucw.h
index 3dedca5c..19218366 100644
--- a/lib/fpucw.h
+++ b/lib/fpucw.h
@@ -1,27 +1,18 @@
/* Manipulating the FPU control word. -*- coding: utf-8 -*-
- Copyright (C) 2007-2018 Free Software Foundation, Inc.
+ Copyright (C) 2007-2022 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2007.
- This program is free software: you can redistribute it and/or
- modify it under the terms of either:
+ This file is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
- or
-
- * the GNU General Public License as published by the Free
- Software Foundation; either version 2 of the License, or (at your
- option) any later version.
-
- or both in parallel, as here.
- This program is distributed in the hope that it will be useful,
+ This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ GNU Lesser General Public License for more details.
- You should have received a copy of the GNU General Public License
+ You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */
#ifndef _FPUCW_H
@@ -52,7 +43,7 @@
See Vincent Lefèvre's page https://www.vinc17.net/research/extended.en.html
for a good explanation.
- See http://www.uwsg.iu.edu/hypermail/linux/kernel/0103.0/0453.html for
+ See https://web.archive.org/web/20060905133417/http://www.uwsg.iu.edu/hypermail/linux/kernel/0103.0/0453.html
some argumentation which setting should be the default. */
/* This header file provides the following facilities:
@@ -70,8 +61,8 @@
'long double' safe operation precision
*/
-/* Inline assembler like this works only with GNU C. */
-#if (defined __i386__ || defined __x86_64__) && defined __GNUC__
+/* Inline assembler like this works only with GNU C and clang. */
+#if (defined __i386__ || defined __x86_64__) && (defined __GNUC__ || defined __clang__)
typedef unsigned short fpucw_t; /* glibc calls this fpu_control_t */
@@ -79,12 +70,12 @@ typedef unsigned short fpucw_t; /* glibc calls this fpu_control_t */
# define FPU_PC_DOUBLE 0x200 /* glibc calls this _FPU_DOUBLE */
# define FPU_PC_EXTENDED 0x300 /* glibc calls this _FPU_EXTENDED */
-# define GET_FPUCW() \
+# define GET_FPUCW() __extension__ \
({ fpucw_t _cw; \
__asm__ __volatile__ ("fnstcw %0" : "=m" (*&_cw)); \
_cw; \
})
-# define SET_FPUCW(word) \
+# define SET_FPUCW(word) __extension__ \
(void)({ fpucw_t _ncw = (word); \
__asm__ __volatile__ ("fldcw %0" : : "m" (*&_ncw)); \
})