aboutsummaryrefslogtreecommitdiff
path: root/modules/permut~.c
diff options
context:
space:
mode:
authorKatja <katjav@users.sourceforge.net>2011-11-06 14:41:44 +0000
committerKatja <katjav@users.sourceforge.net>2011-11-06 14:41:44 +0000
commit4f1ee28d687d583601d41ff58e1618b381d2675f (patch)
treeeb9df33c9928ec11de287a1d70ec714c9a3b9f7c /modules/permut~.c
parent4a05094c9a009707674c079c0481eaf8e1f8490f (diff)
made creb compliant with double precision
- changed float to t_float - adapted subnormal detection svn path=/trunk/externals/creb/; revision=15706
Diffstat (limited to 'modules/permut~.c')
-rw-r--r--modules/permut~.c20
1 files changed, 14 insertions, 6 deletions
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)