SURFEX v7.3
General documentation of Surfex
 All Classes Files Functions Variables Typedefs
/home/dasprezs/EXPORT_v7_3/src/LIB/LFI_COMPRESS/include/ieee754.h
Go to the documentation of this file.
00001 #undef __BYTE_ORDER
00002 
00003 #ifdef BIG_endian
00004 # define __BYTE_ORDER 1234
00005 #endif
00006 #ifdef LITTLE_endian
00007 # define __BYTE_ORDER 4321
00008 #endif
00009 #if !(defined(__BYTE_ORDER))
00010  #error "ieee754.h : you MUST specify \
00011 -DBIG_endian or -DLITTLE_endian \
00012 in CPPFLAGS of your Makefile."
00013 /* Compiler must throw us out at this point! */
00014 #endif
00015 
00016 #define __BIG_ENDIAN    1234
00017 #define __LITTLE_ENDIAN 4321
00018 
00019 union ieee754_double
00020   {
00021     double d;
00022 
00023     /* This is the IEEE 754 double-precision format.  */
00024     struct
00025       {
00026 #if     __BYTE_ORDER == __BIG_ENDIAN
00027         unsigned int negative:1;
00028         unsigned int exponent:11;
00029         /* Together these comprise the mantissa.  */
00030         unsigned int mantissa0:20;
00031         unsigned int mantissa1:32;
00032 #endif                          /* Big endian.  */
00033 #if     __BYTE_ORDER == __LITTLE_ENDIAN
00034         /* Together these comprise the mantissa.  */
00035         unsigned int mantissa1:32;
00036         unsigned int mantissa0:20;
00037         unsigned int exponent:11;
00038         unsigned int negative:1;
00039 #endif                          /* Little endian.  */
00040       } ieee;
00041 
00042     /* This format makes it easier to see if a NaN is a signalling NaN.  */
00043     struct
00044       {
00045 #if     __BYTE_ORDER == __BIG_ENDIAN
00046         unsigned int negative:1;
00047         unsigned int exponent:11;
00048         unsigned int quiet_nan:1;
00049         /* Together these comprise the mantissa.  */
00050         unsigned int mantissa0:19;
00051         unsigned int mantissa1:32;
00052 #else
00053         /* Together these comprise the mantissa.  */
00054         unsigned int mantissa1:32;
00055         unsigned int mantissa0:19;
00056         unsigned int quiet_nan:1;
00057         unsigned int exponent:11;
00058         unsigned int negative:1;
00059 #endif
00060       } ieee_nan;
00061   };
00062 
00063 #define IEEE754_DOUBLE_BIAS     0x3ff /* Added to exponent.  */