Mercurial > octave
annotate liboctave/wrappers/fpucw-wrappers.c @ 33639:65b1cf6aa60a bytecode-interpreter tip
maint: Merge default to bytecode-interpreter
author | Arun Giridhar <arungiridhar@gmail.com> |
---|---|
date | Mon, 03 Jun 2024 14:38:47 -0400 |
parents | 2e484f9f1f18 |
children |
rev | line source |
---|---|
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
1 //////////////////////////////////////////////////////////////////////// |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
2 // |
32632
2e484f9f1f18
maint: update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
31706
diff
changeset
|
3 // Copyright (C) 2016-2024 The Octave Project Developers |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
4 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
5 // See the file COPYRIGHT.md in the top-level directory of this |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
6 // distribution or <https://octave.org/copyright/>. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
7 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
8 // This file is part of Octave. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
9 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
10 // Octave is free software: you can redistribute it and/or modify it |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
11 // under the terms of the GNU General Public License as published by |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
12 // the Free Software Foundation, either version 3 of the License, or |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
13 // (at your option) any later version. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
14 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
15 // Octave is distributed in the hope that it will be useful, but |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
16 // WITHOUT ANY WARRANTY; without even the implied warranty of |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
18 // GNU General Public License for more details. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
19 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
20 // You should have received a copy of the GNU General Public License |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
21 // along with Octave; see the file COPYING. If not, see |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
22 // <https://www.gnu.org/licenses/>. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
23 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
24 //////////////////////////////////////////////////////////////////////// |
21894 | 25 |
26 // The fpucw macros are provided by gnulib. We don't include gnulib | |
27 // headers directly in Octave's C++ source files to avoid problems that | |
28 // may be caused by the way that gnulib overrides standard library | |
29 // functions. | |
30 | |
31 #if defined (HAVE_CONFIG_H) | |
32 # include "config.h" | |
33 #endif | |
34 | |
35 #if defined (HAVE_FPU_CONTROL_H) | |
36 # include <fpu_control.h> | |
37 #endif | |
38 | |
39 #include "fpucw.h" | |
40 | |
22073
d18c63a45070
wrappers for setting long double rounding mode (bug #48319)
John W. Eaton <jwe@octave.org>
parents:
21894
diff
changeset
|
41 #include "fpucw-wrappers.h" |
21894 | 42 |
43 #if ! defined (_FPU_DEFAULT) | |
44 # if defined __i386__ || defined __x86_64__ | |
45 # define _FPU_DEFAULT 0x037f | |
46 # else | |
47 # define _FPU_DEFAULT 0 | |
48 # endif | |
49 #endif | |
50 | |
51 void | |
52 octave_set_default_fpucw (void) | |
53 { | |
54 fpucw_t cw = GET_FPUCW (); | |
55 | |
56 if (cw != _FPU_DEFAULT) | |
57 SET_FPUCW (_FPU_DEFAULT); | |
58 } | |
22073
d18c63a45070
wrappers for setting long double rounding mode (bug #48319)
John W. Eaton <jwe@octave.org>
parents:
21894
diff
changeset
|
59 |
25684
a5263875ffdc
avoid unused variable warning on some systems
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
60 // OLDCW is the name used by the fpucw.h macros and gnulib doesn't give |
25689
ff473a4187e5
avoid error in gnulib wrapper on systems that don't have fpu control word
John W. Eaton <jwe@octave.org>
parents:
25684
diff
changeset
|
61 // us a choice. We are also assuming that fpucw_t is unsigned, and no |
ff473a4187e5
avoid error in gnulib wrapper on systems that don't have fpu control word
John W. Eaton <jwe@octave.org>
parents:
25684
diff
changeset
|
62 // wider than an int. |
22073
d18c63a45070
wrappers for setting long double rounding mode (bug #48319)
John W. Eaton <jwe@octave.org>
parents:
21894
diff
changeset
|
63 |
d18c63a45070
wrappers for setting long double rounding mode (bug #48319)
John W. Eaton <jwe@octave.org>
parents:
21894
diff
changeset
|
64 unsigned int |
d18c63a45070
wrappers for setting long double rounding mode (bug #48319)
John W. Eaton <jwe@octave.org>
parents:
21894
diff
changeset
|
65 octave_begin_long_double_rounding (void) |
d18c63a45070
wrappers for setting long double rounding mode (bug #48319)
John W. Eaton <jwe@octave.org>
parents:
21894
diff
changeset
|
66 { |
25689
ff473a4187e5
avoid error in gnulib wrapper on systems that don't have fpu control word
John W. Eaton <jwe@octave.org>
parents:
25684
diff
changeset
|
67 // Don't use DECL_LONG_DOUBLE_ROUNDING here because on some systems, |
27956
2310164737b3
fix many spelling errors (bug #57613)
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
68 // it is defined to be empty. |
25689
ff473a4187e5
avoid error in gnulib wrapper on systems that don't have fpu control word
John W. Eaton <jwe@octave.org>
parents:
25684
diff
changeset
|
69 |
ff473a4187e5
avoid error in gnulib wrapper on systems that don't have fpu control word
John W. Eaton <jwe@octave.org>
parents:
25684
diff
changeset
|
70 fpucw_t oldcw = 0; |
22073
d18c63a45070
wrappers for setting long double rounding mode (bug #48319)
John W. Eaton <jwe@octave.org>
parents:
21894
diff
changeset
|
71 |
d18c63a45070
wrappers for setting long double rounding mode (bug #48319)
John W. Eaton <jwe@octave.org>
parents:
21894
diff
changeset
|
72 BEGIN_LONG_DOUBLE_ROUNDING (); |
d18c63a45070
wrappers for setting long double rounding mode (bug #48319)
John W. Eaton <jwe@octave.org>
parents:
21894
diff
changeset
|
73 |
d18c63a45070
wrappers for setting long double rounding mode (bug #48319)
John W. Eaton <jwe@octave.org>
parents:
21894
diff
changeset
|
74 return oldcw; |
d18c63a45070
wrappers for setting long double rounding mode (bug #48319)
John W. Eaton <jwe@octave.org>
parents:
21894
diff
changeset
|
75 } |
d18c63a45070
wrappers for setting long double rounding mode (bug #48319)
John W. Eaton <jwe@octave.org>
parents:
21894
diff
changeset
|
76 |
d18c63a45070
wrappers for setting long double rounding mode (bug #48319)
John W. Eaton <jwe@octave.org>
parents:
21894
diff
changeset
|
77 void |
d18c63a45070
wrappers for setting long double rounding mode (bug #48319)
John W. Eaton <jwe@octave.org>
parents:
21894
diff
changeset
|
78 octave_end_long_double_rounding (unsigned int oldcw) |
d18c63a45070
wrappers for setting long double rounding mode (bug #48319)
John W. Eaton <jwe@octave.org>
parents:
21894
diff
changeset
|
79 { |
d18c63a45070
wrappers for setting long double rounding mode (bug #48319)
John W. Eaton <jwe@octave.org>
parents:
21894
diff
changeset
|
80 END_LONG_DOUBLE_ROUNDING (); |
25684
a5263875ffdc
avoid unused variable warning on some systems
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
81 |
a5263875ffdc
avoid unused variable warning on some systems
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
82 // It might be unused. |
a5263875ffdc
avoid unused variable warning on some systems
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
83 octave_unused_parameter (oldcw); |
22073
d18c63a45070
wrappers for setting long double rounding mode (bug #48319)
John W. Eaton <jwe@octave.org>
parents:
21894
diff
changeset
|
84 } |