]> www.ginac.de Git - cln.git/commitdiff
* m4/param.m4: Add support for MinGW.
authorRichard Kreckel <kreckel@ginac.de>
Thu, 3 Aug 2006 21:48:10 +0000 (21:48 +0000)
committerRichard Kreckel <kreckel@ginac.de>
Thu, 3 Aug 2006 21:48:10 +0000 (21:48 +0000)
        * src/base/random/cl_random_from.cc: Fix for last patch.

ChangeLog
m4/param.m4
src/base/random/cl_random_from.cc

index 94fd5c2aa543b48aa575d1e8ee5d0d4a9a2d5034..2c9f72508d1bfe8e6da6556e668aeede3e651c69 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2006-08-03  Sheplyakov Alexei  <varg@theor.jinr.ru>
+
+       * m4/param.m4: Add support for MinGW.
+       * src/base/random/cl_random_from.cc: Fix for last patch.
+
 2006-07-23  Sheplyakov Alexei  <varg@theor.jinr.ru>
 
        * src/base/random/cl_random_from.cc: Add support for MinGW.
index 2a6b07d4f6e5fa00b7b1d9e414f7b8dd73b3a7ff..21a7b84e2207a27f503122fd6200bc3f636c2305 100644 (file)
@@ -31,9 +31,9 @@ CC=`echo "$CC " | sed -e 's/-O //g'`
 fi
 AC_TRY_EVAL(ac_link)
 CC="$ORIGCC"
-if test -s conftest; then
+if test -s conftest${ac_exeext}; then
   echo "creating $cl_machine_file_h"
-  ./conftest > conftest.h
+  ./conftest${ac_exeext} > conftest.h
   if cmp -s "$cl_machine_file_h" conftest.h 2>/dev/null; then
     # The file exists and we would not be changing it
     rm -f conftest.h
index 0470a4e76bd105e8b3484d2bf745e06db7ebe4e8..eb9552a252f0ee64d2b7755f5e39cb7005fac055 100644 (file)
@@ -1,5 +1,10 @@
 // random_state constructor.
 
+
+#if defined(_WIN32)
+#include <windows.h> // For GetCurrentProcessId(), must be included first, sorry.
+#endif
+
 // General includes.
 #include "cl_sysdep.h"
 
@@ -9,10 +14,6 @@
 
 // Implementation.
 
-#if defined(_WIN32)
-#include <windows.h> // for GetCurrentProcessId()
-#endif
-
 #include "cl_base_config.h"
 #include "cl_low.h"
 #include <cstdlib>  // declares rand()
   extern "C" int gettimeofday (struct timeval * tp, GETTIMEOFDAY_TZP_T tzp);
 #endif
 
+namespace cln {
 inline uint32 get_seed (void)
 {
        var struct timeval tv;
        gettimeofday(&tv,0);
-       return cln::highlow32(tv.tv_sec,tv.tv_usec); // 16+16 zufällige Bits
+       return highlow32(tv.tv_sec,tv.tv_usec); // 16+16 zufällige Bits
 }
+}  // namespace cln
 
 #elif defined(HAVE_TIMES_CLOCK)
 
@@ -67,7 +70,7 @@ inline uint32 get_seed (void)
 {
        struct timeb timebuf;
        ftime(&timebuf);
-       return cln::highlow32(timebuf.time, (long)(timebuf.millitm)*1000);
+       return highlow32(timebuf.time, (long)(timebuf.millitm)*1000);
 }
 }  // namespace cln
 
@@ -84,14 +87,14 @@ random_state::random_state ()
        var uint32 seed_hi;
        var uint32 seed_lo;
 #if defined(unix) || defined(__unix) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__) || defined(_AIX) || defined(sinix) || (defined(__MACH__) && defined(__APPLE__)) || (defined(__CYGWIN__) && defined(__GNUC__)) || defined(__BEOS__)
-       seed_lo = ::get_seed();
+       seed_lo = get_seed();
        seed_hi = (rand() // zufällige 31 Bit (bei UNIX_BSD) bzw. 16 Bit (bei UNIX_SYSV)
                           << 8) ^ (uintL)(getpid()); // ca. 8 Bit von der Process ID
 #elif defined(__OpenBSD__)
        seed_lo = arc4random();
        seed_hi = arc4random();
 #elif defined(_WIN32)
-       seed_lo = ::get_seed();
+       seed_lo = get_seed();
        seed_hi = (rand() << 8) ^ (uintL)(GetCurrentProcessId());
 #elif defined(__atarist)
        seed_lo = highlow32(GEMDOS_GetDate(),GEMDOS_GetTime()); // 16+16 zufällige Bits