cleanup-misc.patch from patch #6230.
[pspp-builds.git] / src / libpspp / magic.h
1 /* PSPP - a program for statistical analysis.
2    Copyright (C) 1997-9, 2000 Free Software Foundation, Inc.
3
4    This program is free software: you can redistribute it and/or modify
5    it under the terms of the GNU General Public License as published by
6    the Free Software Foundation, either version 3 of the License, or
7    (at your option) any later version.
8
9    This program is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12    GNU General Public License for more details.
13
14    You should have received a copy of the GNU General Public License
15    along with this program.  If not, see <http://www.gnu.org/licenses/>. */
16
17 #if !magic_h
18 #define magic_h 1
19
20 /* Magic numbers. */
21
22 #include <float.h>
23 #include <limits.h>
24
25 /* Allows us to specify individual bytes of a double. */
26 union cvt_dbl {
27   unsigned char cvt_dbl_i[8];
28   double cvt_dbl_d;
29 };
30
31
32 /* "Second-lowest value" bytes for an IEEE-754 double. */
33 #if WORDS_BIGENDIAN
34 #define SECOND_LOWEST_BYTES {0xff,0xef,0xff,0xff, 0xff,0xff,0xff,0xfe}
35 #else
36 #define SECOND_LOWEST_BYTES {0xfe,0xff,0xff,0xff, 0xff,0xff,0xef,0xff}
37 #endif
38
39 /* "Second-lowest value" for a double. */
40 #if __GNUC__
41 #define second_lowest_value                                               \
42         (__extension__ ((union cvt_dbl) {SECOND_LOWEST_BYTES}).cvt_dbl_d)
43 #else /* not GNU C */
44 extern union cvt_dbl second_lowest_value_union;
45 #define second_lowest_value (second_lowest_value_union.cvt_dbl_d)
46 #endif
47
48 /* Used when we want a "missing value". */
49 #define NOT_DOUBLE (-DBL_MAX)
50 #define NOT_LONG LONG_MIN
51 #define NOT_INT INT_MIN
52
53 #endif /* magic.h */