[GiNaC-list] Results of GiNaC (& CLN) builds

Sheplyakov Alexei varg at theor.jinr.ru
Fri Jul 14 20:52:52 CEST 2006


> > In building CLN I had to do considerable finagling with the Makefiles.
> I don't think this is necessary. As a matter of fact, CLN builds with
> *unmodified makefiles* just fine. However, it is necessary to modify
> src/base/random/cl_random_from.cc. (see the attachment).

Oops, I've forgotten to attach the patch.

-- 
All science is either physics or stamp collecting.

-------------- next part --------------
--- src/base/random/cl_random_from.cc	2005-12-21 20:15:03.000000000 +0300
+++ src/base/random/cl_random_from.cc~	2005-12-21 20:11:40.000000000 +0300
@@ -1,5 +1,9 @@
 // random_state constructor.
 
+#if defined(_WIN32)
+#include <windows.h> // for GetCurrentProcessId()
+#endif
+
 // General includes.
 #include "cl_sysdep.h"
 
@@ -11,12 +15,12 @@
 
 #include "cl_base_config.h"
 #include "cl_low.h"
+#include <cstdlib>  // declares rand()
 
-#if defined(unix) || defined(__unix) || defined(_AIX) || defined(sinix) || (defined(__MACH__) && defined(__APPLE__)) || (defined(_WIN32) && defined(__GNUC__)) || defined(__BEOS__)
+#if defined(unix) || defined(__unix) || defined(_AIX) || defined(sinix) || (defined(__MACH__) && defined(__APPLE__)) || (defined(__CYGWIN__) && defined(__GNUC__)) || defined(__BEOS__)
 
 #include <sys/types.h>
 #include <unistd.h> // declares getpid()
-#include <cstdlib>  // declares rand()
 
 #if defined(HAVE_GETTIMEOFDAY)
 
@@ -52,8 +56,20 @@
 
 #endif
 
+#elif defined(_WIN32)
+#include <sys/time.h>
+#include <sys/timeb.h>
+
+inline uint32 get_seed (void)
+{
+	struct timeb timebuf;
+	ftime(&timebuf);
+	return cln::highlow32(timebuf.time, (long)(timebuf.millitm)*1000);
+}
+
 #endif
 
+
 namespace cln {
 
 // Counter, to avoid that two random-states created immediately one after
@@ -64,10 +80,13 @@
 {
 	var uint32 seed_hi;
 	var uint32 seed_lo;
-#if defined(unix) || defined(__unix) || defined(_AIX) || defined(sinix) || (defined(__MACH__) && defined(__APPLE__)) || (defined(_WIN32) && defined(__GNUC__)) || defined(__BEOS__)
+#if defined(unix) || defined(__unix) || defined(_AIX) || defined(sinix) || (defined(__MACH__) && defined(__APPLE__)) || (defined(__CYGWIN) && defined(__GNUC__)) || defined(__BEOS__)
 	seed_lo = ::get_seed();
 	seed_hi = (rand() // zuf?ige 31 Bit (bei UNIX_BSD) bzw. 16 Bit (bei UNIX_SYSV)
                           << 8) ^ (uintL)(getpid()); // ca. 8 Bit von der Process ID
+#elif defined(_WIN32)
+	seed_lo = ::get_seed();
+	seed_hi = (rand() << 8) ^ (uintL)(GetCurrentProcessId());
 #elif defined(__atarist)
 	seed_lo = highlow32(GEMDOS_GetDate(),GEMDOS_GetTime()); // 16+16 zuf?ige Bits
 	seed_hi = XBIOS_Random(); // 24 Bit zuf?ig vom XBIOS, vorne 8 Nullbits
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 827 bytes
Desc: Digital signature
Url : http://www.cebix.net/pipermail/ginac-list/attachments/20060714/e67e39ae/attachment.pgp


More information about the GiNaC-list mailing list