X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fmagic.h;h=fd4629a458cb0ca00558b084b0a967a5e63705b2;hb=2e0595dd8e344dbdcab740d7d2a3b67d153d6b39;hp=3693f23f394d09ad63da76b1e235f386948b1f08;hpb=fa77efde13ecbb261b90109142453850b283b950;p=pspp-builds.git diff --git a/src/magic.h b/src/magic.h index 3693f23f..fd4629a4 100644 --- a/src/magic.h +++ b/src/magic.h @@ -25,16 +25,33 @@ #include #include -#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". */