From 4f1ee28d687d583601d41ff58e1618b381d2675f Mon Sep 17 00:00:00 2001 From: Katja Date: Sun, 6 Nov 2011 14:41:44 +0000 Subject: made creb compliant with double precision - changed float to t_float - adapted subnormal detection svn path=/trunk/externals/creb/; revision=15706 --- modules/permut~.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'modules/permut~.c') diff --git a/modules/permut~.c b/modules/permut~.c index 402d007..58da769 100644 --- a/modules/permut~.c +++ b/modules/permut~.c @@ -25,6 +25,11 @@ //#include "m_pd.h" #include "extlib_util.h" +typedef union +{ + float f; + unsigned int i; +}t_permutflint; typedef struct permutctl @@ -34,6 +39,7 @@ typedef struct permutctl int c_blocksize; } t_permutctl; + typedef struct permut { t_object x_obj; @@ -64,9 +70,10 @@ static void permut_random(t_permut *x, t_floatarg seed) int mask = N-1; t_int *p = x->x_ctl.c_permutationtable; int r, last = 0; - - //srand(* ((unsigned int *)(&seed))); - srand (((t_flint)seed).i); + t_permutflint flintseed; + + flintseed.f = (float)seed; + srand(flintseed.i); if(p) { @@ -92,9 +99,10 @@ static void permut_random(t_permut *x, t_floatarg seed) static void permut_bang(t_permut *x) { - unsigned int r = rand(); - //permut_random(x, *((t_float *)(&r))); - permut_random(x, ((t_flint)r).f); + t_permutflint seed; + seed.i = rand(); + t_float floatseed = (t_float)seed.f; + permut_random(x, floatseed); } static void permut_resize_table(t_permut *x, int size) -- cgit v1.2.1