| 1 | /* Temporary library support for decimal floating point. |
| 2 | Copyright (C) 2005, 2006 Free Software Foundation, Inc. |
| 3 | |
| 4 | This file is part of GCC. |
| 5 | |
| 6 | GCC is free software; you can redistribute it and/or modify it |
| 7 | under the terms of the GNU General Public License as published by |
| 8 | the Free Software Foundation; either version 2, or (at your option) |
| 9 | any later version. |
| 10 | |
| 11 | In addition to the permissions in the GNU General Public License, the |
| 12 | Free Software Foundation gives you unlimited permission to link the |
| 13 | compiled version of this file into combinations with other programs, |
| 14 | and to distribute those combinations without any restriction coming |
| 15 | from the use of this file. (The General Public License restrictions |
| 16 | do apply in other respects; for example, they cover modification of |
| 17 | the file, and distribution when not linked into a combine |
| 18 | executable.) |
| 19 | |
| 20 | GCC is distributed in the hope that it will be useful, but WITHOUT |
| 21 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
| 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public |
| 23 | License for more details. |
| 24 | |
| 25 | You should have received a copy of the GNU General Public License |
| 26 | along with GCC; see the file COPYING. If not, write to the Free |
| 27 | Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA |
| 28 | 02110-1301, USA. */ |
| 29 | |
| 30 | #include <fenv.h> |
| 31 | #include "dconfig.h" |
| 32 | #include "decContext.h" |
| 33 | #include "decExcept.h" |
| 34 | |
| 35 | /* Internal, non-documented functions for testing libgcc functions. |
| 36 | This support is not sufficient for real use. */ |
| 37 | |
| 38 | static int __dfp_except_flags = 0; |
| 39 | |
| 40 | /* Clear the dummy exception flags. */ |
| 41 | void |
| 42 | __dfp_clear_except (void) |
| 43 | { |
| 44 | __dfp_except_flags = 0; |
| 45 | } |
| 46 | |
| 47 | /* Return the dummy exception flags corresponding to the mask. */ |
| 48 | int |
| 49 | __dfp_test_except (int mask) |
| 50 | { |
| 51 | return __dfp_except_flags & mask; |
| 52 | } |
| 53 | |
| 54 | /* Set dummy exception flags. */ |
| 55 | void |
| 56 | __dfp_raise_except (int flags) |
| 57 | { |
| 58 | __dfp_except_flags |= flags; |
| 59 | } |