Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix compilation errors about unused or uninitialized variables.
[simgrid.git] / src / xbt / RngStream.c
index fb81143..2608d16 100644 (file)
@@ -346,6 +346,27 @@ void RngStream_DeleteStream (RngStream * p)
 
 /*-------------------------------------------------------------------------*/
 
+RngStream RngStream_CopyStream (const RngStream src)
+{
+   RngStream g;
+   
+   if(src == NULL) {
+     printf ("RngStream_CopyStream: 'src' not initialized\n\n");
+     exit (EXIT_FAILURE);
+   }
+
+   g = (RngStream) malloc (sizeof (struct RngStream_InfoState));
+   if (g == NULL) {
+      printf ("RngStream_CopyStream: No more memory\n\n");
+      exit (EXIT_FAILURE);
+   }
+   memcpy((void*) g, (void*) src, sizeof (struct RngStream_InfoState));
+
+   return g;
+}
+
+/*-------------------------------------------------------------------------*/
+
 void RngStream_ResetStartStream (RngStream g)
 {
    int i;
@@ -517,3 +538,15 @@ int RngStream_RandInt (RngStream g, int i, int j)
 {
    return i + (int) ((j - i + 1.0) * RngStream_RandU01 (g));
 }
+
+/* Undefine this terms, or supernovae build will fail. */
+#undef norm
+#undef m1
+#undef m2
+#undef a12
+#undef a13n
+#undef a21
+#undef a23n
+#undef two17
+#undef two53
+#undef fact