[PATCH 03/10] jscript: Added NaN value implementation.
Alexandre Julliard
julliard at winehq.org
Wed Oct 15 08:11:15 CDT 2008
Jacek Caban <jacek at codeweavers.com> writes:
> +#include <math.h>
> +#include "basetsd.h"
> +
> +#ifndef NAN
> +
> +#ifdef __GNUC__
> +
> +# define NAN \
> + (__extension__ \
> + ((union { unsigned __l __attribute__ ((__mode__ (__SI__))); float __d; }) \
> + { __l: 0x7fc00000UL }).__d)
> +
> +#else /* __GNUC__ */
> +
> +#ifdef WORDS_BIGENDIAN
> +# define __nan_bytes { 0x7f, 0xc0, 0, 0 }
> +#else
> +# define __nan_bytes { 0, 0, 0xc0, 0x7f }
> +#endif
> +
> +static union { unsigned char __c[4]; float __d; } __nan_union
> + __attribute_used__ = { __nan_bytes };
> +# define NAN (__nan_union.__d)
> +
> +#endif /* __GNUC__ */
> +
> +#endif /* NAN */
I'd suggest to take advantage of the variant union instead of copying
all these glibc definitions. Something like
#ifdef NAN
V_R8(&vt) = NAN;
#else
V_I8(&vt) = nan_magic_pattern;
#endif
--
Alexandre Julliard
julliard at winehq.org
More information about the wine-devel
mailing list