Added new files resulting from directory restructuring.
[pspp-builds.git] / src / magic.h
index 3693f23f394d09ad63da76b1e235f386948b1f08..e6bc7edbf29730e11b3a3563bebd35faacc5d077 100644 (file)
@@ -14,8 +14,8 @@
 
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-   02111-1307, USA. */
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+   02110-1301, USA. */
 
 #if !magic_h
 #define magic_h 1
 #include <float.h>
 #include <limits.h>
 
-#if ENDIAN != UNKNOWN
-#define endian ENDIAN
-#else
-extern int endian;
+/* Check that the floating-point representation is one that we
+   understand. */
+#ifndef FPREP_IEEE754
+#error Only IEEE-754 floating point currently supported.
 #endif
 
-#ifdef SECOND_LOWEST_VALUE
-#define second_lowest_value SECOND_LOWEST_VALUE
+/* Allows us to specify individual bytes of a double. */     
+union cvt_dbl {
+  unsigned char cvt_dbl_i[8];
+  double cvt_dbl_d;
+};
+
+
+/* "Second-lowest value" bytes for an IEEE-754 double. */
+#if WORDS_BIGENDIAN
+#define SECOND_LOWEST_BYTES {0xff,0xef,0xff,0xff, 0xff,0xff,0xff,0xfe}
 #else
-extern double second_lowest_value;
+#define SECOND_LOWEST_BYTES {0xfe,0xff,0xff,0xff, 0xff,0xff,0xef,0xff}
+#endif
+
+/* "Second-lowest value" for a double. */
+#if __GNUC__
+#define second_lowest_value                                               \
+        (__extension__ ((union cvt_dbl) {SECOND_LOWEST_BYTES}).cvt_dbl_d)
+#else /* not GNU C */
+extern union cvt_dbl second_lowest_value_union;
+#define second_lowest_value (second_lowest_value_union.cvt_dbl_d)
 #endif
 
 /* Used when we want a "missing value". */