| 1 | /* gsl_mode.h |
| 2 | * |
| 3 | * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2004 Gerard Jungman |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation; either version 3 of the License, or (at |
| 8 | * your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, but |
| 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | * General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program; if not, write to the Free Software |
| 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 18 | */ |
| 19 | |
| 20 | /* Author: B. Gough and G. Jungman */ |
| 21 | |
| 22 | #ifndef __GSL_MODE_H__ |
| 23 | #define __GSL_MODE_H__ |
| 24 | #include <gsl/gsl_inline.h> |
| 25 | |
| 26 | #undef __BEGIN_DECLS |
| 27 | #undef __END_DECLS |
| 28 | #ifdef __cplusplus |
| 29 | # define __BEGIN_DECLS extern "C" { |
| 30 | # define __END_DECLS } |
| 31 | #else |
| 32 | # define __BEGIN_DECLS /* empty */ |
| 33 | # define __END_DECLS /* empty */ |
| 34 | #endif |
| 35 | |
| 36 | __BEGIN_DECLS |
| 37 | |
| 38 | |
| 39 | /* Some functions can take a mode argument. This |
| 40 | * is a rough method to do things like control |
| 41 | * the precision of the algorithm. This mainly |
| 42 | * occurs in special functions, but we figured |
| 43 | * it was ok to have a general facility. |
| 44 | * |
| 45 | * The mode type is 32-bit field. Most of |
| 46 | * the fields are currently unused. Users |
| 47 | * '|' various predefined constants to get |
| 48 | * a desired mode. |
| 49 | */ |
| 50 | typedef unsigned int gsl_mode_t; |
| 51 | |
| 52 | |
| 53 | /* Here are the predefined constants. |
| 54 | * Note that the precision constants |
| 55 | * are special because they are used |
| 56 | * to index arrays, so do not change |
| 57 | * them. The precision information is |
| 58 | * in the low order 3 bits of gsl_mode_t |
| 59 | * (the third bit is currently unused). |
| 60 | */ |
| 61 | |
| 62 | /* Note that "0" is double precision, |
| 63 | * so that you get that by default if |
| 64 | * you forget a flag. |
| 65 | */ |
| 66 | #define GSL_PREC_DOUBLE 0 |
| 67 | #define GSL_PREC_SINGLE 1 |
| 68 | #define GSL_PREC_APPROX 2 |
| 69 | |
| 70 | #ifdef HAVE_INLINE |
| 71 | INLINE_FUN unsigned int GSL_MODE_PREC(gsl_mode_t mt); |
| 72 | |
| 73 | INLINE_FUN unsigned int |
| 74 | GSL_MODE_PREC(gsl_mode_t mt) |
| 75 | { return (mt & (unsigned int)7); } |
| 76 | #else /* HAVE_INLINE */ |
| 77 | #define GSL_MODE_PREC(mt) ((mt) & (unsigned int)7) |
| 78 | #endif /* HAVE_INLINE */ |
| 79 | |
| 80 | |
| 81 | /* Here are some predefined generic modes. |
| 82 | */ |
| 83 | #define GSL_MODE_DEFAULT 0 |
| 84 | |
| 85 | |
| 86 | __END_DECLS |
| 87 | |
| 88 | #endif /* __GSL_MODE_H__ */ |
| 89 | |