[project @ 1999-09-13 11:01:05 by sof]
authorsof <unknown>
Mon, 13 Sep 1999 11:01:07 +0000 (11:01 +0000)
committersof <unknown>
Mon, 13 Sep 1999 11:01:07 +0000 (11:01 +0000)
GMP only depends on libiberty for the implementation of random().
Avoid this dep. on a (pure) Win32 platform.

ghc/rts/gmp/mpn/generic/random2.c
ghc/rts/gmp/urandom.h

index 2954608..7ac442a 100644 (file)
@@ -31,6 +31,14 @@ random ()
 {
   return mrand48 ();
 }
+#elif defined(_WIN32) && !(defined(__CYGWIN__) || defined(__CYGWIN32__))
+/* MS CRT supplies just the poxy rand(), with an upper bound of 0x7fff */
+static inline unsigned long
+random ()
+{
+  return rand () ^ (rand () << 16) ^ (rand() << 32);
+}
+
 #else
 long random ();
 #endif
index 994e7bd..37221c2 100644 (file)
@@ -29,6 +29,16 @@ urandom ()
 #define __URANDOM
 #endif
 
+#if defined(_WIN32) && !(defined(__CYGWIN__) || defined(__CYGWIN32__))
+/* MS CRT supplies just the poxy rand(), with an upper bound of 0x7fff */
+static inline unsigned long
+urandom ()
+{
+  return rand () ^ (rand () << 16) ^ (rand() << 32);
+}
+#define __URANDOM
+#endif
+
 #if defined (__alpha) && !defined (__URANDOM)
 /* DEC OSF/1 1.2 random() returns a double.  */
 long mrand48 ();