[fix] warnings in klib/ksort.h

This commit is contained in:
Al
2015-10-26 18:50:22 -04:00
parent 3b3513ffe3
commit 6b456025b4

View File

@@ -240,7 +240,7 @@ typedef struct {
static void ks_shuffle_##name(size_t n, type_t a[]) \
{ \
int i, j; \
for (i = n; i > 1; --i) { \
for (i = (int)n; i > 1; --i) { \
type_t tmp; \
j = (int)(drand48() * i); \
tmp = a[j]; a[j] = a[i-1]; a[i-1] = tmp; \
@@ -248,7 +248,7 @@ typedef struct {
} \
static void ks_sample_##name(size_t n, size_t r, type_t a[]) /* FIXME: NOT TESTED!!! */ \
{ /* reference: http://code.activestate.com/recipes/272884/ */ \
int i, k, pop = n; \
int i, k, pop = (int)n; \
for (i = (int)r, k = 0; i >= 0; --i) { \
double z = 1., x = drand48(); \
type_t tmp; \