[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdeartwork/kscreensaver/kdesavers
From:       Andy Fawcett <andy () athame ! co ! uk>
Date:       2004-06-29 19:44:18
Message-ID: 20040629194418.E2E6D9449 () office ! kde ! org
[Download RAW message or body]

CVS commit by fawcett: 

More portable support for NAN on 2.95 based systems, the original
workaround for this problem didn't work on FreeBSD 4.x (reported to
kde-core-devel@)

This code is based on some in Qt itself, and gratuitously simplified
by Michael Nottebrock, Frerich Raabe and myself.


  M +14 -5     vec3.cpp   1.3


--- kdeartwork/kscreensaver/kdesavers/vec3.cpp  #1.2:1.3
@@ -11,8 +11,17 @@
 //============================================================================
 
-#ifndef _ISOC99_SOURCE
-// NAN is not defined by default for gcc 2.95. Enable the ISO C99 extensions
-// which includes the definition of NAN.
-#define _ISOC99_SOURCE 1
+#include <math.h>
+#if !defined(NAN)
+static inline double nan__()
+{
+    static const unsigned int one = 1;
+    static const bool BigEndian = (*((unsigned char *) &one) == 0);
+
+    static const unsigned char be_nan_bytes[] = { 0x7f, 0xf8, 0, 0, 0, 0, 0, 0 };
+    static const unsigned char le_nan_bytes[] = { 0, 0, 0, 0, 0, 0, 0xf8, 0x7f };
+
+    return *( ( const double * )( BigEndian ? be_nan_bytes : le_nan_bytes ) );
+}
+#   define NAN (::nan__())
 #endif
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic