aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIOhannes m zmölnig <zmoelnig@users.sourceforge.net>2003-06-18 13:53:18 +0000
committerIOhannes m zmölnig <zmoelnig@users.sourceforge.net>2003-06-18 13:53:18 +0000
commitdff74800d391a08e024cabb8ec13f96223a44601 (patch)
tree9c5704167222ebdff01792d6392251b8e68921a4
parent730ca1c8b36145dbb80f28e4c72642bafdb66995 (diff)
if a prime is detected, "1" is send, else "0" (no more bangs)
svn path=/trunk/externals/zexy/; revision=706
-rw-r--r--src/z_prime.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/z_prime.c b/src/z_prime.c
index 5e4a9d0..6d0f100 100644
--- a/src/z_prime.c
+++ b/src/z_prime.c
@@ -16,19 +16,25 @@ void prime_float(t_prime *x, t_float f)
unsigned int max_divisor;
unsigned int divisor=1;
- if (f<2)return;
+ if (f<2){
+ outlet_float(x->x_obj.ob_outlet, 0.0);
+ return;
+ }
if (!(i%2)){
- if (i==2)outlet_bang(x->x_obj.ob_outlet);
+ outlet_float(x->x_obj.ob_outlet, (t_float)(i==2));
return;
}
max_divisor = sqrt(f)+1;
while ((divisor+=2)<max_divisor)
- if (!(i%divisor)) return;
+ if (!(i%divisor)) {
+ outlet_float(x->x_obj.ob_outlet, 0.0);
+ return;
+ }
- outlet_bang(x->x_obj.ob_outlet);
+ outlet_float(x->x_obj.ob_outlet, 1.0);
}
void *prime_new(void)