X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fmagic.h;h=e6bc7edbf29730e11b3a3563bebd35faacc5d077;hb=92fb12eb06716d14c05b781f5d9dcde956d77c30;hp=3693f23f394d09ad63da76b1e235f386948b1f08;hpb=4944c86a9318bc5b5578ab145a95c116ffd2c9fd;p=pspp diff --git a/src/magic.h b/src/magic.h index 3693f23f39..e6bc7edbf2 100644 --- a/src/magic.h +++ b/src/magic.h @@ -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 @@ -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". */