Changeset: 1a1be68cd958 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=1a1be68cd958
Modified Files:
        common/utils/Makefile.ag
        common/utils/mtwist.c
        gdk/Makefile.ag
        gdk/gdk_sample.c
Branch: stratified_sampling
Log Message:

Update Makefiles and fix minor bugs


diffs (61 lines):

diff --git a/common/utils/Makefile.ag b/common/utils/Makefile.ag
--- a/common/utils/Makefile.ag
+++ b/common/utils/Makefile.ag
@@ -30,4 +30,9 @@ lib_msabaoth = {
        SOURCES = msabaoth.h msabaoth.c
 }
 
+lib_mtwist = {
+       NOINST
+       SOURCES = mtwist.h mtwist.c
+}
+
 EXTRA_DIST = s_nextafterf.c math_private.h strptime.c
diff --git a/common/utils/mtwist.c b/common/utils/mtwist.c
--- a/common/utils/mtwist.c
+++ b/common/utils/mtwist.c
@@ -189,16 +189,17 @@ inline double mtwist_drand(mtwist* mt) {
  * [a,b] 
  */
 inline int mtwist_uniform_int(mtwist* mt, int a, int b) {
+    unsigned int range, scale, max_x, x;
     if(b < a) {//invalid range!
         return 0;
     }
-    unsigned int range = b-a+1;
-    unsigned int scale = 4294967295UL/range;
+    range = b-a+1;
+    scale = 4294967295UL/range;
         //4294967295UL=2^32-1=RAND_MAX for this Mersenne Twister
-    unsigned int max_x = range*scale;
+    max_x = range*scale;
+
     //x will be uniform in [0, max_x[
     //Since past%range=0, x%range will be uniform in [0,range[
-    unsigned int x; 
     do {
         x = mtwist_u32rand(mt);
     } while(x >= max_x);
diff --git a/gdk/Makefile.ag b/gdk/Makefile.ag
--- a/gdk/Makefile.ag
+++ b/gdk/Makefile.ag
@@ -35,6 +35,7 @@ lib_gdk = {
        LIBS = ../common/options/libmoptions \
                ../common/stream/libstream \
                ../common/utils/libmutils \
+               ../common/utils/libmtwist \
                $(MATH_LIBS) $(SOCKET_LIBS) $(zlib_LIBS) $(BZ_LIBS) \
                $(MALLOC_LIBS) $(PTHREAD_LIBS) $(DL_LIBS) $(PSAPILIB) 
$(KVM_LIBS)
 }
diff --git a/gdk/gdk_sample.c b/gdk/gdk_sample.c
--- a/gdk/gdk_sample.c
+++ b/gdk/gdk_sample.c
@@ -27,7 +27,7 @@
 #include "gdk.h"
 #include "gdk_private.h"
 
-#include <mtwist.h>
+#include "mtwist.h"
 
 #undef BATsample
 
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to