aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIOhannes m zmölnig <zmoelnig@users.sourceforge.net>2006-01-20 10:28:50 +0000
committerIOhannes m zmölnig <zmoelnig@users.sourceforge.net>2006-01-20 10:28:50 +0000
commita653a495d8e467ab776b850c481657776e004794 (patch)
treeb736c9efacf2eaa1197cf16a38f82ec7c1da132c
parent606e9c641ed11578e3400c2bc3fe4b1a5d98c9aa (diff)
split z_sigbin.c into separate files and adapted to the hexnameloader of the upcoming pd-0.40;
changed the "dot.c" into "0x2e.c" (conforms to the hexnameloader) so now each object is in a separate c-file which reflects the object's name in a generic way svn path=/trunk/externals/zexy/; revision=4452
-rw-r--r--src/0x260x260x7e.c300
-rw-r--r--src/0x2e.c (renamed from src/dot.c)11
-rw-r--r--src/0x3c0x7e.c263
-rw-r--r--src/0x3d0x3d0x7e.c259
-rw-r--r--src/0x3e0x7e.c260
-rw-r--r--src/0x7c0x7c0x7e.c276
-rw-r--r--src/z_sigbin.c714
-rw-r--r--src/z_zexy.c8
-rw-r--r--src/z_zexy.h8
9 files changed, 1381 insertions, 718 deletions
diff --git a/src/0x260x260x7e.c b/src/0x260x260x7e.c
new file mode 100644
index 0000000..471c20b
--- /dev/null
+++ b/src/0x260x260x7e.c
@@ -0,0 +1,300 @@
+/******************************************************
+ *
+ * zexy - implementation file
+ *
+ * copyleft (c) IOhannes m zmölnig
+ *
+ * 1999:forum::für::umläute:2006
+ *
+ * institute of electronic music and acoustics (iem)
+ *
+ ******************************************************
+ *
+ * license: GNU General Public License v.2
+ *
+ ******************************************************/
+
+/*
+ finally :: some of the missing binops for signals :: &&~
+
+ 1302:forum::für::umläute:2000
+*/
+
+#include "zexy.h"
+
+/* ------------------------ logical~ ----------------------------- */
+
+/* ----------------------------- andand_tilde ----------------------------- */
+static t_class *andand_tilde_class, *scalarandand_tilde_class;
+
+typedef struct _andand_tilde
+{
+ t_object x_obj;
+ float x_f;
+} t_andand_tilde;
+
+typedef struct _scalarandand_tilde
+{
+ t_object x_obj;
+ float x_f;
+ t_float x_g; /* inlet value */
+} t_scalarandand_tilde;
+
+static void *andand_tilde_new(t_symbol *s, int argc, t_atom *argv)
+{
+ if (argc > 1) post("&&~: extra arguments ignored");
+ if (argc)
+ {
+ t_scalarandand_tilde *x = (t_scalarandand_tilde *)pd_new(scalarandand_tilde_class);
+ floatinlet_new(&x->x_obj, &x->x_g);
+ x->x_g = atom_getfloatarg(0, argc, argv);
+ outlet_new(&x->x_obj, &s_signal);
+ x->x_f = 0;
+ return (x);
+ }
+ else
+ {
+ t_andand_tilde *x = (t_andand_tilde *)pd_new(andand_tilde_class);
+ inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal);
+ outlet_new(&x->x_obj, &s_signal);
+ x->x_f = 0;
+ return (x);
+ }
+}
+
+t_int *andand_tilde_perform(t_int *w)
+{
+ t_float *in1 = (t_float *)(w[1]);
+ t_float *in2 = (t_float *)(w[2]);
+ t_float *out = (t_float *)(w[3]);
+ int n = (int)(w[4]);
+ while (n--){
+ int f=(int)*in1++;
+ int g=(int)*in2++;
+ *out++ = (f && g);
+ }
+ return (w+5);
+}
+
+t_int *andand_tilde_perf8(t_int *w)
+{
+ t_float *in1 = (t_float *)(w[1]);
+ t_float *in2 = (t_float *)(w[2]);
+ t_float *out = (t_float *)(w[3]);
+ int n = (int)(w[4]);
+ for (; n; n -= 8, in1 += 8, in2 += 8, out += 8)
+ {
+ int f0 = in1[0], f1 = in1[1], f2 = in1[2], f3 = in1[3];
+ int f4 = in1[4], f5 = in1[5], f6 = in1[6], f7 = in1[7];
+
+ int g0 = in2[0], g1 = in2[1], g2 = in2[2], g3 = in2[3];
+ int g4 = in2[4], g5 = in2[5], g6 = in2[6], g7 = in2[7];
+
+ out[0] = f0 && g0; out[1] = f1 && g1; out[2] = f2 && g2; out[3] = f3 && g3;
+ out[4] = f4 && g4; out[5] = f5 && g5; out[6] = f6 && g6; out[7] = f7 && g7;
+ }
+ return (w+5);
+}
+
+t_int *scalarandand_tilde_perform(t_int *w)
+{
+ t_float *in = (t_float *)(w[1]);
+ t_float f = *(t_float *)(w[2]);
+ t_float *out = (t_float *)(w[3]);
+ int n = (int)(w[4]);
+ while (n--) *out++ = (int)*in++ && (int)f;
+ return (w+5);
+}
+
+t_int *scalarandand_tilde_perf8(t_int *w)
+{
+ t_float *in = (t_float *)(w[1]);
+ int g = *(t_float *)(w[2]);
+ t_float *out = (t_float *)(w[3]);
+ int n = (int)(w[4]);
+ for (; n; n -= 8, in += 8, out += 8)
+ {
+ int f0 = in[0], f1 = in[1], f2 = in[2], f3 = in[3];
+ int f4 = in[4], f5 = in[5], f6 = in[6], f7 = in[7];
+
+ out[0] = f0 && g; out[1] = f1 && g; out[2] = f2 && g; out[3] = f3 && g;
+ out[4] = f4 && g; out[5] = f5 && g; out[6] = f6 && g; out[7] = f7 && g;
+ }
+ return (w+5);
+}
+
+#ifdef __SSE__
+static long l_bitmask[]={0x7fffffff, 0x7fffffff, 0x7fffffff, 0x7fffffff};
+
+t_int *andand_tilde_performSSE(t_int *w)
+{
+ __m128 *in1 = (__m128 *)(w[1]);
+ __m128 *in2 = (__m128 *)(w[2]);
+ __m128 *out = (__m128 *)(w[3]);
+ int n = (int)(w[4])>>4;
+
+ const __m128 bitmask= _mm_loadu_ps((float*)l_bitmask); /* for getting the absolute value */
+ const __m128 one = _mm_set1_ps(1.f);
+
+ while (n--) {
+ __m128 xmm0, xmm1, xmm2;
+ xmm0 = _mm_and_ps (in1[0] , bitmask); /* =abs(f); */
+ xmm1 = _mm_and_ps (in2[0] , bitmask);
+ xmm0 = _mm_cmpge_ps(xmm0 , one); /* =(abs(f)>=1.0)=i (a weird cast to integer) */
+ xmm1 = _mm_cmpge_ps(xmm1 , one);
+ xmm2 = _mm_and_ps (xmm0 , xmm1); /* =(i0&&i1) */
+ out[0] = _mm_and_ps (xmm2 , one); /* 0xfffffff -> 1.0 */
+
+ xmm0 = _mm_and_ps (in1[1] , bitmask);
+ xmm1 = _mm_and_ps (in2[1] , bitmask);
+ xmm0 = _mm_cmpge_ps(xmm0 , one);
+ xmm1 = _mm_cmpge_ps(xmm1 , one);
+ xmm2 = _mm_and_ps (xmm0 , xmm1);
+ out[1] = _mm_and_ps (xmm2 , one);
+
+ xmm0 = _mm_and_ps (in1[2] , bitmask);
+ xmm1 = _mm_and_ps (in2[2] , bitmask);
+ xmm0 = _mm_cmpge_ps(xmm0 , one);
+ xmm1 = _mm_cmpge_ps(xmm1 , one);
+ xmm2 = _mm_and_ps (xmm0 , xmm1);
+ out[2] = _mm_and_ps (xmm2 , one);
+
+ xmm0 = _mm_and_ps (in1[3] , bitmask);
+ xmm1 = _mm_and_ps (in2[3] , bitmask);
+ xmm0 = _mm_cmpge_ps(xmm0 , one);
+ xmm1 = _mm_cmpge_ps(xmm1 , one);
+ xmm2 = _mm_and_ps (xmm0 , xmm1);
+ out[3] = _mm_and_ps (xmm2 , one);
+
+ in1+=4;
+ in2+=4;
+ out+=4;
+ }
+
+ return (w+5);
+}
+t_int *scalarandand_tilde_performSSE(t_int *w)
+{
+ __m128 *in = (__m128 *)(w[1]);
+ __m128 *out = (__m128 *)(w[3]);
+ t_float f = *(t_float *)(w[2]);
+ __m128 scalar = _mm_set1_ps(f);
+ int n = (int)(w[4])>>4;
+
+ const __m128 bitmask= _mm_loadu_ps((float*)l_bitmask); /* for getting the absolute value */
+ const __m128 one = _mm_set1_ps(1.f);
+
+ scalar = _mm_and_ps (scalar, bitmask);
+ scalar = _mm_cmpge_ps(scalar, one );
+
+
+ while (n--) {
+ __m128 xmm0, xmm1;
+ xmm0 = _mm_and_ps (in[0], bitmask); /* =abs(f); */
+ xmm0 = _mm_cmpge_ps(xmm0 , one); /* =(abs(f)>=1.0)=i (a weird cast to integer) */
+ xmm0 = _mm_and_ps (xmm0 , scalar); /* =(i0&&i1) */
+ out[0] = _mm_and_ps (xmm0 , one); /* 0xfffffff -> 1.0 */
+
+ xmm1 = _mm_and_ps (in[1], bitmask);
+ xmm1 = _mm_cmpge_ps(xmm1 , one);
+ xmm1 = _mm_and_ps (xmm1 , scalar);
+ out[1] = _mm_and_ps (xmm1 , one);
+
+ xmm0 = _mm_and_ps (in[2], bitmask);
+ xmm0 = _mm_cmpge_ps(xmm0 , one);
+ xmm0 = _mm_and_ps (xmm0 , scalar);
+ out[2] = _mm_and_ps (xmm0 , one);
+
+ xmm1 = _mm_and_ps (in[3], bitmask);
+ xmm1 = _mm_cmpge_ps(xmm1 , one);
+ xmm1 = _mm_and_ps (xmm1 , scalar);
+ out[3] = _mm_and_ps (xmm1 , one);
+
+ in +=4;
+ out+=4;
+ }
+ return (w+5);
+}
+#endif /* __SSE__ */
+
+static void andand_tilde_dsp(t_andand_tilde *x, t_signal **sp)
+{
+ t_sample*in1=sp[0]->s_vec;
+ t_sample*in2=sp[1]->s_vec;
+ t_sample*out=sp[2]->s_vec;
+
+ int n=sp[0]->s_n;
+
+#ifdef __SSE__
+ if(
+ Z_SIMD_CHKBLOCKSIZE(n)&&
+ Z_SIMD_CHKALIGN(in1)&&
+ Z_SIMD_CHKALIGN(in2)&&
+ Z_SIMD_CHKALIGN(out)
+ )
+ {
+ dsp_add(andand_tilde_performSSE, 4, in1, in2, out, n);
+ } else
+#endif
+ if (n&7)
+ dsp_add(andand_tilde_perform, 4, in1, in2, out, n);
+ else
+ dsp_add(andand_tilde_perf8, 4, in1, in2, out, n);
+}
+
+static void scalarandand_tilde_dsp(t_scalarandand_tilde *x, t_signal **sp)
+{
+ t_sample*in =sp[0]->s_vec;
+ t_sample*out=sp[1]->s_vec;
+ int n =sp[0]->s_n;
+
+#ifdef __SSE__
+ if(
+ Z_SIMD_CHKBLOCKSIZE(n)&&
+ Z_SIMD_CHKALIGN(in)&&
+ Z_SIMD_CHKALIGN(out)
+ )
+ {
+ dsp_add(scalarandand_tilde_performSSE, 4, in, &x->x_g, out, n);
+ } else
+#endif
+ if (n&7)
+ dsp_add(scalarandand_tilde_perform, 4, in, &x->x_g, out, n);
+ else
+ dsp_add(scalarandand_tilde_perf8, 4, in, &x->x_g, out, n);
+}
+
+static void andand_tilde_setup(void)
+{
+ andand_tilde_class = class_new(gensym("&&~"), (t_newmethod)andand_tilde_new, 0,
+ sizeof(t_andand_tilde), 0, A_GIMME, 0);
+ class_addmethod(andand_tilde_class, (t_method)andand_tilde_dsp, gensym("dsp"), 0);
+ CLASS_MAINSIGNALIN(andand_tilde_class, t_andand_tilde, x_f);
+ class_sethelpsymbol(andand_tilde_class, gensym("zexy/sigbinops+"));
+ scalarandand_tilde_class = class_new(gensym("&&~"), 0, 0,
+ sizeof(t_scalarandand_tilde), 0, 0);
+ CLASS_MAINSIGNALIN(scalarandand_tilde_class, t_scalarandand_tilde, x_f);
+ class_addmethod(scalarandand_tilde_class, (t_method)scalarandand_tilde_dsp, gensym("dsp"),
+ 0);
+ class_sethelpsymbol(scalarandand_tilde_class, gensym("zexy/sigbinops+"));
+
+ zexy_register("&&~");
+}
+
+
+/* ---------------------- global setup ------------------------- */
+void z_andand__setup(void)
+{
+ andand_tilde_setup();
+}
+
+void z_0x260x260x7e_setup(void)
+{
+ andand_tilde_setup();
+}
+
+void setup_0x260x260x7e(void)
+{
+ andand_tilde_setup();
+}
+
diff --git a/src/dot.c b/src/0x2e.c
index 734b563..5ecd238 100644
--- a/src/dot.c
+++ b/src/0x2e.c
@@ -165,3 +165,14 @@ void z_dot_setup(void)
{
dot_setup();
}
+
+void z_0x2e_setup(void)
+{
+ dot_setup();
+}
+
+void setup_0x2e(void)
+{
+ dot_setup();
+}
+
diff --git a/src/0x3c0x7e.c b/src/0x3c0x7e.c
new file mode 100644
index 0000000..e489190
--- /dev/null
+++ b/src/0x3c0x7e.c
@@ -0,0 +1,263 @@
+/******************************************************
+ *
+ * zexy - implementation file
+ *
+ * copyleft (c) IOhannes m zmölnig
+ *
+ * 1999:forum::für::umläute:2004
+ *
+ * institute of electronic music and acoustics (iem)
+ *
+ ******************************************************
+ *
+ * license: GNU General Public License v.2
+ *
+ ******************************************************/
+
+/*
+ finally :: some of the missing binops for signals :: <~
+
+ 1302:forum::für::umläute:2000
+*/
+
+#include "zexy.h"
+
+/* ------------------------ relational~ ----------------------------- */
+
+
+/* ----------------------------- lt_tilde ----------------------------- */
+static t_class *lt_tilde_class, *scalarlt_tilde_class;
+
+typedef struct _lt_tilde
+{
+ t_object x_obj;
+ float x_f;
+} t_lt_tilde;
+
+typedef struct _scalarlt_tilde
+{
+ t_object x_obj;
+ float x_f;
+ t_float x_g; /* inlet value */
+} t_scalarlt_tilde;
+
+static void *lt_tilde_new(t_symbol *s, int argc, t_atom *argv)
+{
+ if (argc > 1) post("<~: extra arguments ignored");
+ if (argc)
+ {
+ t_scalarlt_tilde *x = (t_scalarlt_tilde *)pd_new(scalarlt_tilde_class);
+ floatinlet_new(&x->x_obj, &x->x_g);
+ x->x_g = atom_getfloatarg(0, argc, argv);
+ outlet_new(&x->x_obj, &s_signal);
+ x->x_f = 0;
+ return (x);
+ }
+ else
+ {
+ t_lt_tilde *x = (t_lt_tilde *)pd_new(lt_tilde_class);
+ inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal);
+ outlet_new(&x->x_obj, &s_signal);
+ x->x_f = 0;
+ return (x);
+ }
+}
+
+t_int *lt_tilde_perform(t_int *w)
+{
+ t_float *in1 = (t_float *)(w[1]);
+ t_float *in2 = (t_float *)(w[2]);
+ t_float *out = (t_float *)(w[3]);
+ int n = (int)(w[4]);
+ while (n--) *out++ = *in1++ < *in2++;
+ return (w+5);
+}
+
+t_int *lt_tilde_perf8(t_int *w)
+{
+ t_float *in1 = (t_float *)(w[1]);
+ t_float *in2 = (t_float *)(w[2]);
+ t_float *out = (t_float *)(w[3]);
+ int n = (int)(w[4]);
+ for (; n; n -= 8, in1 += 8, in2 += 8, out += 8)
+ {
+ float f0 = in1[0], f1 = in1[1], f2 = in1[2], f3 = in1[3];
+ float f4 = in1[4], f5 = in1[5], f6 = in1[6], f7 = in1[7];
+
+ float g0 = in2[0], g1 = in2[1], g2 = in2[2], g3 = in2[3];
+ float g4 = in2[4], g5 = in2[5], g6 = in2[6], g7 = in2[7];
+
+ out[0] = f0 < g0; out[1] = f1 < g1; out[2] = f2 < g2; out[3] = f3 < g3;
+ out[4] = f4 < g4; out[5] = f5 < g5; out[6] = f6 < g6; out[7] = f7 < g7;
+ }
+ return (w+5);
+}
+
+t_int *scalarlt_tilde_perform(t_int *w)
+{
+ t_float *in = (t_float *)(w[1]);
+ t_float f = *(t_float *)(w[2]);
+ t_float *out = (t_float *)(w[3]);
+ int n = (int)(w[4]);
+ while (n--) *out++ = *in++ < f;
+ return (w+5);
+}
+
+t_int *scalarlt_tilde_perf8(t_int *w)
+{
+ t_float *in = (t_float *)(w[1]);
+ t_float g = *(t_float *)(w[2]);
+ t_float *out = (t_float *)(w[3]);
+ int n = (int)(w[4]);
+ for (; n; n -= 8, in += 8, out += 8)
+ {
+ float f0 = in[0], f1 = in[1], f2 = in[2], f3 = in[3];
+ float f4 = in[4], f5 = in[5], f6 = in[6], f7 = in[7];
+
+ out[0] = f0 < g; out[1] = f1 < g; out[2] = f2 < g; out[3] = f3 < g;
+ out[4] = f4 < g; out[5] = f5 < g; out[6] = f6 < g; out[7] = f7 < g;
+ }
+ return (w+5);
+}
+#ifdef __SSE__
+t_int *lt_tilde_performSSE(t_int *w)
+{
+ __m128 *in1 = (__m128 *)(w[1]);
+ __m128 *in2 = (__m128 *)(w[2]);
+ __m128 *out = (__m128 *)(w[3]);
+ int n = (int)(w[4])>>4;
+ const __m128 one = _mm_set1_ps(1.f);
+
+ while (n--) {
+ __m128 xmm0, xmm1, xmm2;
+ xmm0 = _mm_cmplt_ps(in1[0], in2[0]);
+ out[0] = _mm_and_ps (xmm0 , one);
+
+ xmm1 = _mm_cmplt_ps(in1[1], in2[1]);
+ out[1] = _mm_and_ps (xmm1 , one);
+
+ xmm0 = _mm_cmplt_ps(in1[2], in2[2]);
+ out[2] = _mm_and_ps (xmm0 , one);
+
+ xmm1 = _mm_cmplt_ps(in1[3], in2[3]);
+ out[3] = _mm_and_ps (xmm1 , one);
+
+ in1+=4;
+ in2+=4;
+ out+=4;
+ }
+
+ return (w+5);
+}
+t_int *scalarlt_tilde_performSSE(t_int *w)
+{
+ __m128 *in = (__m128 *)(w[1]);
+ __m128 *out = (__m128 *)(w[3]);
+ t_float f = *(t_float *)(w[2]);
+ __m128 scalar = _mm_set1_ps(f);
+ int n = (int)(w[4])>>4;
+ const __m128 one = _mm_set1_ps(1.f);
+
+ while (n--) {
+ __m128 xmm0, xmm1;
+ xmm0 = _mm_cmplt_ps (in[0], scalar);
+ out[0] = _mm_and_ps (xmm0, one);
+
+ xmm1 = _mm_cmplt_ps (in[1], scalar);
+ out[1] = _mm_and_ps (xmm1, one);
+
+ xmm0 = _mm_cmplt_ps (in[2], scalar);
+ out[2] = _mm_and_ps (xmm0, one);
+
+ xmm1 = _mm_cmplt_ps (in[3], scalar);
+ out[3] = _mm_and_ps (xmm1, one);
+
+ in +=4;
+ out+=4;
+ }
+ return (w+5);
+}
+#endif /* __SSE__ */
+
+static void lt_tilde_dsp(t_lt_tilde *x, t_signal **sp)
+{
+ t_sample*in1=sp[0]->s_vec;
+ t_sample*in2=sp[1]->s_vec;
+ t_sample*out=sp[2]->s_vec;
+
+ int n=sp[0]->s_n;
+
+#ifdef __SSE__
+ if(
+ Z_SIMD_CHKBLOCKSIZE(n)&&
+ Z_SIMD_CHKALIGN(in1)&&
+ Z_SIMD_CHKALIGN(in2)&&
+ Z_SIMD_CHKALIGN(out)
+ )
+ {
+ post("SIMD");
+ dsp_add(lt_tilde_performSSE, 4, in1, in2, out, n);
+ } else
+#endif
+ if(n&7)
+ dsp_add(lt_tilde_perform, 4, in1, in2, out, n);
+ else
+ dsp_add(lt_tilde_perf8, 4, in1, in2, out, n);
+}
+
+static void scalarlt_tilde_dsp(t_scalarlt_tilde *x, t_signal **sp)
+{
+ t_sample*in =sp[0]->s_vec;
+ t_sample*out=sp[1]->s_vec;
+ int n =sp[0]->s_n;
+
+#ifdef __SSE__
+ if(
+ Z_SIMD_CHKBLOCKSIZE(n)&&
+ Z_SIMD_CHKALIGN(in)&&
+ Z_SIMD_CHKALIGN(out)
+ )
+ {
+ post("SIMD");
+ dsp_add(scalarlt_tilde_performSSE, 4, in, &x->x_g, out, n);
+ } else
+#endif
+ if (n&7)
+ dsp_add(scalarlt_tilde_perform, 4, in, &x->x_g, out, n);
+ else
+ dsp_add(scalarlt_tilde_perf8, 4, in, &x->x_g, out, n);
+}
+
+static void lt_tilde_setup(void)
+{
+ lt_tilde_class = class_new(gensym("<~"), (t_newmethod)lt_tilde_new, 0,
+ sizeof(t_lt_tilde), 0, A_GIMME, 0);
+ class_addmethod(lt_tilde_class, (t_method)lt_tilde_dsp, gensym("dsp"), 0);
+ CLASS_MAINSIGNALIN(lt_tilde_class, t_lt_tilde, x_f);
+ class_sethelpsymbol(lt_tilde_class, gensym("zexy/sigbinops+"));
+ scalarlt_tilde_class = class_new(gensym("<~"), 0, 0,
+ sizeof(t_scalarlt_tilde), 0, 0);
+ CLASS_MAINSIGNALIN(scalarlt_tilde_class, t_scalarlt_tilde, x_f);
+ class_addmethod(scalarlt_tilde_class, (t_method)scalarlt_tilde_dsp, gensym("dsp"),
+ 0);
+ class_sethelpsymbol(scalarlt_tilde_class, gensym("zexy/sigbinops+"));
+ zexy_register("<~");
+}
+
+
+/* ---------------------- global setup ------------------------- */
+void z_lt__setup(void)
+{
+ lt_tilde_setup();
+}
+
+void z_0x3c0x7e_setup(void)
+{
+ lt_tilde_setup();
+}
+
+void setup_0x3c0x7e(void)
+{
+ lt_tilde_setup();
+}
+
diff --git a/src/0x3d0x3d0x7e.c b/src/0x3d0x3d0x7e.c
new file mode 100644
index 0000000..c089a28
--- /dev/null
+++ b/src/0x3d0x3d0x7e.c
@@ -0,0 +1,259 @@
+/******************************************************
+ *
+ * zexy - implementation file
+ *
+ * copyleft (c) IOhannes m zmölnig
+ *
+ * 1999:forum::für::umläute:2004
+ *
+ * institute of electronic music and acoustics (iem)
+ *
+ ******************************************************
+ *
+ * license: GNU General Public License v.2
+ *
+ ******************************************************/
+
+/*
+ finally :: some of the missing binops for signals :: ==~
+
+ 1302:forum::für::umläute:2000
+*/
+
+#include "zexy.h"
+
+/* ----------------------------- eq_tilde ----------------------------- */
+static t_class *eq_tilde_class, *scalareq_tilde_class;
+
+typedef struct _eq_tilde
+{
+ t_object x_obj;
+ float x_f;
+} t_eq_tilde;
+
+typedef struct _scalareq_tilde
+{
+ t_object x_obj;
+ float x_f;
+ t_float x_g; /* inlet value */
+} t_scalareq_tilde;
+
+static void *eq_tilde_new(t_symbol *s, int argc, t_atom *argv)
+{
+ if (argc > 1) post("==~: extra arguments ignored");
+ if (argc)
+ {
+ t_scalareq_tilde *x = (t_scalareq_tilde *)pd_new(scalareq_tilde_class);
+ floatinlet_new(&x->x_obj, &x->x_g);
+ x->x_g = atom_getfloatarg(0, argc, argv);
+ outlet_new(&x->x_obj, &s_signal);
+ x->x_f = 0;
+ return (x);
+ }
+ else
+ {
+ t_eq_tilde *x = (t_eq_tilde *)pd_new(eq_tilde_class);
+ inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal);
+ outlet_new(&x->x_obj, &s_signal);
+ x->x_f = 0;
+ return (x);
+ }
+}
+
+t_int *eq_tilde_perform(t_int *w)
+{
+ t_float *in1 = (t_float *)(w[1]);
+ t_float *in2 = (t_float *)(w[2]);
+ t_float *out = (t_float *)(w[3]);
+ int n = (int)(w[4]);
+ while (n--) *out++ = (*in1++ == *in2++);
+ return (w+5);
+}
+
+t_int *eq_tilde_perf8(t_int *w)
+{
+ t_float *in1 = (t_float *)(w[1]);
+ t_float *in2 = (t_float *)(w[2]);
+ t_float *out = (t_float *)(w[3]);
+ int n = (int)(w[4]);
+ for (; n; n -= 8, in1 += 8, in2 += 8, out += 8)
+ {
+ float f0 = in1[0], f1 = in1[1], f2 = in1[2], f3 = in1[3];
+ float f4 = in1[4], f5 = in1[5], f6 = in1[6], f7 = in1[7];
+
+ float g0 = in2[0], g1 = in2[1], g2 = in2[2], g3 = in2[3];
+ float g4 = in2[4], g5 = in2[5], g6 = in2[6], g7 = in2[7];
+
+ out[0] = f0 == g0; out[1] = f1 == g1; out[2] = f2 == g2; out[3] = f3 == g3;
+ out[4] = f4 == g4; out[5] = f5 == g5; out[6] = f6 == g6; out[7] = f7 == g7;
+ }
+ return (w+5);
+}
+
+t_int *scalareq_tilde_perform(t_int *w)
+{
+ t_float *in = (t_float *)(w[1]);
+ t_float f = *(t_float *)(w[2]);
+ t_float *out = (t_float *)(w[3]);
+ int n = (int)(w[4]);
+ while (n--) *out++ = (*in++ == f);
+ return (w+5);
+}
+
+t_int *scalareq_tilde_perf8(t_int *w)
+{
+ t_float *in = (t_float *)(w[1]);
+ t_float g = *(t_float *)(w[2]);
+ t_float *out = (t_float *)(w[3]);
+ int n = (int)(w[4]);
+ for (; n; n -= 8, in += 8, out += 8)
+ {
+ float f0 = in[0], f1 = in[1], f2 = in[2], f3 = in[3];
+ float f4 = in[4], f5 = in[5], f6 = in[6], f7 = in[7];
+
+ out[0] = (f0 == g); out[1] = (f1 == g); out[2] = (f2 == g); out[3] = (f3 == g);
+ out[4] = (f4 == g); out[5] = (f5 == g); out[6] = (f6 == g); out[7] = (f7 == g);
+ }
+ return (w+5);
+}
+
+#ifdef __SSE__
+t_int *eq_tilde_performSSE(t_int *w)
+{
+ __m128 *in1 = (__m128 *)(w[1]);
+ __m128 *in2 = (__m128 *)(w[2]);
+ __m128 *out = (__m128 *)(w[3]);
+ int n = (int)(w[4])>>4;
+ const __m128 one = _mm_set1_ps(1.f);
+
+ while (n--) {
+ __m128 xmm0, xmm1, xmm2;
+ xmm0 = _mm_cmpeq_ps(in1[0], in2[0]);
+ out[0] = _mm_and_ps (xmm0 , one);
+
+ xmm1 = _mm_cmpeq_ps(in1[1], in2[1]);
+ out[1] = _mm_and_ps (xmm1 , one);
+
+ xmm0 = _mm_cmpeq_ps(in1[2], in2[2]);
+ out[2] = _mm_and_ps (xmm0 , one);
+
+ xmm1 = _mm_cmpeq_ps(in1[3], in2[3]);
+ out[3] = _mm_and_ps (xmm1 , one);
+
+ in1+=4;
+ in2+=4;
+ out+=4;
+ }
+
+ return (w+5);
+}
+t_int *scalareq_tilde_performSSE(t_int *w)
+{
+ __m128 *in = (__m128 *)(w[1]);
+ __m128 *out = (__m128 *)(w[3]);
+ t_float f = *(t_float *)(w[2]);
+ __m128 scalar = _mm_set1_ps(f);
+ int n = (int)(w[4])>>4;
+ const __m128 one = _mm_set1_ps(1.f);
+
+ while (n--) {
+ __m128 xmm0, xmm1;
+ xmm0 = _mm_cmpeq_ps (in[0], scalar);
+ out[0] = _mm_and_ps (xmm0, one);
+
+ xmm1 = _mm_cmpeq_ps (in[1], scalar);
+ out[1] = _mm_and_ps (xmm1, one);
+
+ xmm0 = _mm_cmpeq_ps (in[2], scalar);
+ out[2] = _mm_and_ps (xmm0, one);
+
+ xmm1 = _mm_cmpeq_ps (in[3], scalar);
+ out[3] = _mm_and_ps (xmm1, one);
+
+ in +=4;
+ out+=4;
+ }
+ return (w+5);
+}
+#endif /* __SSE__ */
+
+static void eq_tilde_dsp(t_eq_tilde *x, t_signal **sp)
+{
+ t_sample*in1=sp[0]->s_vec;
+ t_sample*in2=sp[1]->s_vec;
+ t_sample*out=sp[2]->s_vec;
+
+ int n=sp[0]->s_n;
+
+#ifdef __SSE__
+ if(
+ Z_SIMD_CHKBLOCKSIZE(n)&&
+ Z_SIMD_CHKALIGN(in1)&&
+ Z_SIMD_CHKALIGN(in2)&&
+ Z_SIMD_CHKALIGN(out)
+ )
+ {
+ dsp_add(eq_tilde_performSSE, 4, in1, in2, out, n);
+ } else
+#endif
+ if (n&7)
+ dsp_add(eq_tilde_perform, 4, in1, in2, out, n);
+ else
+ dsp_add(eq_tilde_perf8, 4, in1, in2, out, n);
+}
+
+static void scalareq_tilde_dsp(t_scalareq_tilde *x, t_signal **sp)
+{
+ t_sample*in =sp[0]->s_vec;
+ t_sample*out=sp[1]->s_vec;
+ int n =sp[0]->s_n;
+
+#ifdef __SSE__
+ if(
+ Z_SIMD_CHKBLOCKSIZE(n)&&
+ Z_SIMD_CHKALIGN(in)&&
+ Z_SIMD_CHKALIGN(out)
+ )
+ {
+ dsp_add(scalareq_tilde_performSSE, 4, in, &x->x_g, out, n);
+ } else
+#endif
+ if (n&7)
+ dsp_add(scalareq_tilde_perform, 4, in, &x->x_g, out, n);
+ else
+ dsp_add(scalareq_tilde_perf8, 4, in, &x->x_g, out, n);
+}
+
+static void eq_tilde_setup(void)
+{
+ eq_tilde_class = class_new(gensym("==~"), (t_newmethod)eq_tilde_new, 0,
+ sizeof(t_eq_tilde), 0, A_GIMME, 0);
+ class_addmethod(eq_tilde_class, (t_method)eq_tilde_dsp, gensym("dsp"), 0);
+ CLASS_MAINSIGNALIN(eq_tilde_class, t_eq_tilde, x_f);
+ class_sethelpsymbol(eq_tilde_class, gensym("zexy/sigbinops+"));
+ scalareq_tilde_class = class_new(gensym("==~"), 0, 0,
+ sizeof(t_scalareq_tilde), 0, 0);
+ CLASS_MAINSIGNALIN(scalareq_tilde_class, t_scalareq_tilde, x_f);
+ class_addmethod(scalareq_tilde_class, (t_method)scalareq_tilde_dsp, gensym("dsp"),
+ 0);
+ class_sethelpsymbol(scalareq_tilde_class, gensym("zexy/sigbinops+"));
+ zexy_register("==~");
+}
+
+
+/* ---------------------- global setup ------------------------- */
+void z_eq__setup(void)
+{
+ eq_tilde_setup();
+}
+
+void z_0x3d0x3d0x7e_setup(void)
+{
+ eq_tilde_setup();
+}
+
+void setup_0x3d0x3d0x7e(void)
+{
+ eq_tilde_setup();
+}
+
diff --git a/src/0x3e0x7e.c b/src/0x3e0x7e.c
new file mode 100644
index 0000000..081620a
--- /dev/null
+++ b/src/0x3e0x7e.c
@@ -0,0 +1,260 @@
+/******************************************************
+ *
+ * zexy - implementation file
+ *
+ * copyleft (c) IOhannes m zmölnig
+ *
+ * 1999:forum::für::umläute:2004
+ *
+ * institute of electronic music and acoustics (iem)
+ *
+ ******************************************************
+ *
+ * license: GNU General Public License v.2
+ *
+ ******************************************************/
+
+/*
+ finally :: some of the missing binops for signals :: >~
+
+ 1302:forum::für::umläute:2000
+*/
+
+#include "zexy.h"
+
+/* ------------------------ relational~ ----------------------------- */
+
+/* ----------------------------- gt_tilde ----------------------------- */
+static t_class *gt_tilde_class, *scalargt_tilde_class;
+
+typedef struct _gt_tilde
+{
+ t_object x_obj;
+ float x_f;
+} t_gt_tilde;
+
+typedef struct _scalargt_tilde
+{
+ t_object x_obj;
+ float x_f;
+ t_float x_g; /* inlet value */
+} t_scalargt_tilde;
+
+static void *gt_tilde_new(t_symbol *s, int argc, t_atom *argv)
+{
+ if (argc > 1) post(">~: extra arguments ignored");
+ if (argc)
+ {
+ t_scalargt_tilde *x = (t_scalargt_tilde *)pd_new(scalargt_tilde_class);
+ floatinlet_new(&x->x_obj, &x->x_g);
+ x->x_g = atom_getfloatarg(0, argc, argv);
+ outlet_new(&x->x_obj, &s_signal);
+ x->x_f = 0;
+ return (x);
+ }
+ else
+ {
+ t_gt_tilde *x = (t_gt_tilde *)pd_new(gt_tilde_class);
+ inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal);
+ outlet_new(&x->x_obj, &s_signal);
+ x->x_f = 0;
+ return (x);
+ }
+}
+
+t_int *gt_tilde_perform(t_int *w)
+{
+ t_float *in1 = (t_float *)(w[1]);
+ t_float *in2 = (t_float *)(w[2]);
+ t_float *out = (t_float *)(w[3]);
+ int n = (int)(w[4]);
+ while (n--) *out++ = *in1++ > *in2++;
+ return (w+5);
+}
+
+t_int *gt_tilde_perf8(t_int *w)
+{
+ t_float *in1 = (t_float *)(w[1]);
+ t_float *in2 = (t_float *)(w[2]);
+ t_float *out = (t_float *)(w[3]);
+ int n = (int)(w[4]);
+ for (; n; n -= 8, in1 += 8, in2 += 8, out += 8)
+ {
+ float f0 = in1[0], f1 = in1[1], f2 = in1[2], f3 = in1[3];
+ float f4 = in1[4], f5 = in1[5], f6 = in1[6], f7 = in1[7];
+
+ float g0 = in2[0], g1 = in2[1], g2 = in2[2], g3 = in2[3];
+ float g4 = in2[4], g5 = in2[5], g6 = in2[6], g7 = in2[7];
+
+ out[0] = f0 > g0; out[1] = f1 > g1; out[2] = f2 > g2; out[3] = f3 > g3;
+ out[4] = f4 > g4; out[5] = f5 > g5; out[6] = f6 > g6; out[7] = f7 > g7;
+ }
+ return (w+5);
+}
+
+t_int *scalargt_tilde_perform(t_int *w)
+{
+ t_float *in = (t_float *)(w[1]);
+ t_float f = *(t_float *)(w[2]);
+ t_float *out = (t_float *)(w[3]);
+ int n = (int)(w[4]);
+ while (n--) *out++ = *in++ > f;
+ return (w+5);
+}
+
+t_int *scalargt_tilde_perf8(t_int *w)
+{
+ t_float *in = (t_float *)(w[1]);
+ t_float g = *(t_float *)(w[2]);
+ t_float *out = (t_float *)(w[3]);
+ int n = (int)(w[4]);
+ for (; n; n -= 8, in += 8, out += 8)
+ {
+ float f0 = in[0], f1 = in[1], f2 = in[2], f3 = in[3];
+ float f4 = in[4], f5 = in[5], f6 = in[6], f7 = in[7];
+
+ out[0] = f0 > g; out[1] = f1 > g; out[2] = f2 > g; out[3] = f3 > g;
+ out[4] = f4 > g; out[5] = f5 > g; out[6] = f6 > g; out[7] = f7 > g;
+ }
+ return (w+5);
+}
+#ifdef __SSE__
+t_int *gt_tilde_performSSE(t_int *w)
+{
+ __m128 *in1 = (__m128 *)(w[1]);
+ __m128 *in2 = (__m128 *)(w[2]);
+ __m128 *out = (__m128 *)(w[3]);
+ int n = (int)(w[4])>>4;
+ const __m128 one = _mm_set1_ps(1.f);
+
+ while (n--) {
+ __m128 xmm0, xmm1;
+ xmm0 = _mm_cmpgt_ps(in1[0], in2[0]);
+ out[0] = _mm_and_ps (xmm0 , one);
+
+ xmm1 = _mm_cmpgt_ps(in1[1], in2[1]);
+ out[1] = _mm_and_ps (xmm1 , one);
+
+ xmm0 = _mm_cmpgt_ps(in1[2], in2[2]);
+ out[2] = _mm_and_ps (xmm0 , one);
+
+ xmm1 = _mm_cmpgt_ps(in1[3], in2[3]);
+ out[3] = _mm_and_ps (xmm1 , one);
+
+ in1+=4;
+ in2+=4;
+ out+=4;
+ }
+
+ return (w+5);
+}
+t_int *scalargt_tilde_performSSE(t_int *w)
+{
+ __m128 *in = (__m128 *)(w[1]);
+ __m128 *out = (__m128 *)(w[3]);
+ t_float f = *(t_float *)(w[2]);
+ __m128 scalar = _mm_set1_ps(f);
+ int n = (int)(w[4])>>4;
+ const __m128 one = _mm_set1_ps(1.f);
+
+ while (n--) {
+ __m128 xmm0, xmm1;
+ xmm0 = _mm_cmpgt_ps (in[0], scalar);
+ out[0] = _mm_and_ps (xmm0, one);
+
+ xmm1 = _mm_cmpgt_ps (in[1], scalar);
+ out[1] = _mm_and_ps (xmm1, one);
+
+ xmm0 = _mm_cmpgt_ps (in[2], scalar);
+ out[2] = _mm_and_ps (xmm0, one);
+
+ xmm1 = _mm_cmpgt_ps (in[3], scalar);
+ out[3] = _mm_and_ps (xmm1, one);
+
+ in +=4;
+ out+=4;
+ }
+ return (w+5);
+}
+#endif /* __SSE__ */
+
+
+static void gt_tilde_dsp(t_gt_tilde *x, t_signal **sp)
+{
+ t_sample*in1=sp[0]->s_vec;
+ t_sample*in2=sp[1]->s_vec;
+ t_sample*out=sp[2]->s_vec;
+
+ int n=sp[0]->s_n;
+
+#ifdef __SSE__
+ if(
+ Z_SIMD_CHKBLOCKSIZE(n)&&
+ Z_SIMD_CHKALIGN(in1)&&
+ Z_SIMD_CHKALIGN(in2)&&
+ Z_SIMD_CHKALIGN(out)
+ )
+ {
+ dsp_add(gt_tilde_performSSE, 4, in1, in2, out, n);
+ } else
+#endif
+ if (n&7)
+ dsp_add(gt_tilde_perform, 4, in1, in2, out, n);
+ else
+ dsp_add(gt_tilde_perf8, 4, in1, in2, out, n);
+}
+
+static void scalargt_tilde_dsp(t_scalargt_tilde *x, t_signal **sp)
+{
+ t_sample*in =sp[0]->s_vec;
+ t_sample*out=sp[1]->s_vec;
+ int n =sp[0]->s_n;
+
+#ifdef __SSE__
+ if(
+ Z_SIMD_CHKBLOCKSIZE(n)&&
+ Z_SIMD_CHKALIGN(in)&&
+ Z_SIMD_CHKALIGN(out)
+ )
+ {
+ dsp_add(scalargt_tilde_performSSE, 4, in, &x->x_g, out, n);
+ } else
+#endif
+ if (n&7)
+ dsp_add(scalargt_tilde_perform, 4, in, &x->x_g, out, n);
+ else
+ dsp_add(scalargt_tilde_perf8, 4, in, &x->x_g, out, n);
+}
+static void gt_tilde_setup(void)
+{
+ gt_tilde_class = class_new(gensym(">~"), (t_newmethod)gt_tilde_new, 0,
+ sizeof(t_gt_tilde), 0, A_GIMME, 0);
+ class_addmethod(gt_tilde_class, (t_method)gt_tilde_dsp, gensym("dsp"), 0);
+ CLASS_MAINSIGNALIN(gt_tilde_class, t_gt_tilde, x_f);
+ class_sethelpsymbol(gt_tilde_class, gensym("zexy/sigbinops+"));
+ scalargt_tilde_class = class_new(gensym(">~"), 0, 0,
+ sizeof(t_scalargt_tilde), 0, 0);
+ CLASS_MAINSIGNALIN(scalargt_tilde_class, t_scalargt_tilde, x_f);
+ class_addmethod(scalargt_tilde_class, (t_method)scalargt_tilde_dsp, gensym("dsp"),
+ 0);
+ class_sethelpsymbol(scalargt_tilde_class, gensym("zexy/sigbinops+"));
+ zexy_register(">~");
+}
+
+
+/* ---------------------- global setup ------------------------- */
+void z_gt__setup(void)
+{
+ gt_tilde_setup();
+}
+
+void z_0x3e0x7e_setup(void)
+{
+ gt_tilde_setup();
+}
+
+void setup_0x3e0x7e(void)
+{
+ gt_tilde_setup();
+}
+
diff --git a/src/0x7c0x7c0x7e.c b/src/0x7c0x7c0x7e.c
new file mode 100644
index 0000000..8c2afb1
--- /dev/null
+++ b/src/0x7c0x7c0x7e.c
@@ -0,0 +1,276 @@
+/******************************************************
+ *
+ * zexy - implementation file
+ *
+ * copyleft (c) IOhannes m zmölnig
+ *
+ * 1999:forum::für::umläute:2004
+ *
+ * institute of electronic music and acoustics (iem)
+ *
+ ******************************************************
+ *
+ * license: GNU General Public License v.2
+ *
+ ******************************************************/
+
+/*
+ finally :: some of the missing binops for signals :: ||~
+
+ 1302:forum::für::umläute:2000
+*/
+
+#include "zexy.h"
+
+/* ----------------------------- oror_tilde ----------------------------- */
+static t_class *oror_tilde_class, *scalaroror_tilde_class;
+
+typedef struct _oror_tilde
+{
+ t_object x_obj;
+ float x_f;
+} t_oror_tilde;
+
+typedef struct _scalaroror_tilde
+{
+ t_object x_obj;
+ float x_f;
+ t_float x_g; /* inlet value */
+} t_scalaroror_tilde;
+
+static void *oror_tilde_new(t_symbol *s, int argc, t_atom *argv)
+{
+ if (argc > 1) post("||~: extra arguments ignored");
+ if (argc)
+ {
+ t_scalaroror_tilde *x = (t_scalaroror_tilde *)pd_new(scalaroror_tilde_class);
+ floatinlet_new(&x->x_obj, &x->x_g);
+ x->x_g = atom_getfloatarg(0, argc, argv);
+ outlet_new(&x->x_obj, &s_signal);
+ x->x_f = 0;
+ return (x);
+ }
+ else
+ {
+ t_oror_tilde *x = (t_oror_tilde *)pd_new(oror_tilde_class);
+ inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal);
+ outlet_new(&x->x_obj, &s_signal);
+ x->x_f = 0;
+ return (x);
+ }
+}
+
+t_int *oror_tilde_perform(t_int *w)
+{
+ t_float *in1 = (t_float *)(w[1]);
+ t_float *in2 = (t_float *)(w[2]);
+ t_float *out = (t_float *)(w[3]);
+ int n = (int)(w[4]);
+ while (n--) *out++ = (int)*in1++ || (int)*in2++;
+ return (w+5);
+}
+
+t_int *oror_tilde_perf8(t_int *w)
+{
+ t_float *in1 = (t_float *)(w[1]);
+ t_float *in2 = (t_float *)(w[2]);
+ t_float *out = (t_float *)(w[3]);
+ int n = (int)(w[4]);
+ for (; n; n -= 8, in1 += 8, in2 += 8, out += 8)
+ {
+ int f0 = in1[0], f1 = in1[1], f2 = in1[2], f3 = in1[3];
+ int f4 = in1[4], f5 = in1[5], f6 = in1[6], f7 = in1[7];
+
+ int g0 = in2[0], g1 = in2[1], g2 = in2[2], g3 = in2[3];
+ int g4 = in2[4], g5 = in2[5], g6 = in2[6], g7 = in2[7];
+
+ out[0] = f0 || g0; out[1] = f1 || g1; out[2] = f2 || g2; out[3] = f3 || g3;
+ out[4] = f4 || g4; out[5] = f5 || g5; out[6] = f6 || g6; out[7] = f7 || g7;
+ }
+ return (w+5);
+}
+
+t_int *scalaroror_tilde_perform(t_int *w)
+{
+ t_float *in = (t_float *)(w[1]);
+ int f = *(t_float *)(w[2]);
+ t_float *out = (t_float *)(w[3]);
+ int n = (int)(w[4]);
+ while (n--) *out++ = (int)*in++ || f;
+ return (w+5);
+}
+
+t_int *scalaroror_tilde_perf8(t_int *w)
+{
+ t_float *in = (t_float *)(w[1]);
+ int g = *(t_float *)(w[2]);
+ t_float *out = (t_float *)(w[3]);
+ int n = (int)(w[4]);
+ for (; n; n -= 8, in += 8, out += 8)
+ {
+ int f0 = in[0], f1 = in[1], f2 = in[2], f3 = in[3];
+ int f4 = in[4], f5 = in[5], f6 = in[6], f7 = in[7];
+
+ out[0] = f0 || g; out[1] = f1 || g; out[2] = f2 || g; out[3] = f3 || g;
+ out[4] = f4 || g; out[5] = f5 || g; out[6] = f6 || g; out[7] = f7 || g;
+ }
+ return (w+5);
+}
+
+#ifdef __SSE__
+t_int *oror_tilde_performSSE(t_int *w)
+{
+ __m128 *in1 = (__m128 *)(w[1]);
+ __m128 *in2 = (__m128 *)(w[2]);
+ __m128 *out = (__m128 *)(w[3]);
+ int n = (int)(w[4])>>4;
+ const __m128 one = _mm_set1_ps(1.f);
+ const __m128 zero = _mm_setzero_ps();
+
+ while (n--) {
+ __m128 xmm0, xmm1, xmm2;
+ xmm0 = _mm_cmpneq_ps(in1[0], zero);
+ xmm1 = _mm_cmpneq_ps(in2[0], zero);
+ xmm2 = _mm_or_ps (xmm0 , xmm1);
+ out[0] = _mm_and_ps (xmm2 , one);
+
+ xmm0 = _mm_cmpneq_ps(in1[1], zero);
+ xmm1 = _mm_cmpneq_ps(in2[1], zero);
+ xmm2 = _mm_or_ps (xmm0 , xmm1);
+ out[1] = _mm_and_ps (xmm2 , one);
+
+ xmm0 = _mm_cmpneq_ps(in1[2], zero);
+ xmm1 = _mm_cmpneq_ps(in2[2], zero);
+ xmm2 = _mm_or_ps (xmm0 , xmm1);
+ out[2] = _mm_and_ps (xmm2 , one);
+
+ xmm0 = _mm_cmpneq_ps(in1[3], zero);
+ xmm1 = _mm_cmpneq_ps(in2[3], zero);
+ xmm2 = _mm_or_ps (xmm0 , xmm1);
+ out[3] = _mm_and_ps (xmm2 , one);
+
+ in1+=4;
+ in2+=4;
+ out+=4;
+ }
+
+ return (w+5);
+}
+t_int *scalaroror_tilde_performSSE(t_int *w)
+{
+ __m128 *in = (__m128 *)(w[1]);
+ __m128 *out = (__m128 *)(w[3]);
+ t_float f = *(t_float *)(w[2]);
+ __m128 scalar = _mm_set1_ps(f);
+ int n = (int)(w[4])>>4;
+ const __m128 one = _mm_set1_ps(1.f);
+ const __m128 zero = _mm_setzero_ps();
+
+ scalar = _mm_cmpneq_ps(scalar, zero);
+ while (n--) {
+ __m128 xmm0, xmm1;
+ xmm0 = _mm_cmpneq_ps(in[0], zero);
+ xmm1 = _mm_or_ps (xmm0 , scalar);
+ out[0] = _mm_and_ps (xmm1 , one);
+
+ xmm0 = _mm_cmpneq_ps(in[1], zero);
+ xmm1 = _mm_or_ps (xmm0 , scalar);
+ out[1] = _mm_and_ps (xmm1 , one);
+
+ xmm0 = _mm_cmpneq_ps(in[2], zero);
+ xmm1 = _mm_or_ps (xmm0 , scalar);
+ out[2] = _mm_and_ps (xmm1 , one);
+
+ xmm0 = _mm_cmpneq_ps(in[3], zero);
+ xmm1 = _mm_or_ps (xmm0 , scalar);
+ out[3] = _mm_and_ps (xmm1 , one);
+
+
+ in +=4;
+ out+=4;
+ }
+ return (w+5);
+}
+#endif /* __SSE__ */
+
+static void oror_tilde_dsp(t_oror_tilde *x, t_signal **sp)
+{
+ t_sample*in1=sp[0]->s_vec;
+ t_sample*in2=sp[1]->s_vec;
+ t_sample*out=sp[2]->s_vec;
+
+ int n=sp[0]->s_n;
+
+#ifdef __SSE__
+ if(
+ Z_SIMD_CHKBLOCKSIZE(n)&&
+ Z_SIMD_CHKALIGN(in1)&&
+ Z_SIMD_CHKALIGN(in2)&&
+ Z_SIMD_CHKALIGN(out)
+ )
+ {
+ dsp_add(oror_tilde_performSSE, 4, in1, in2, out, n);
+ } else
+#endif
+ if(n&7)
+ dsp_add(oror_tilde_perform, 4, in1, in2, out, n);
+ else
+ dsp_add(oror_tilde_perf8, 4, in1, in2, out, n);
+}
+
+static void scalaroror_tilde_dsp(t_scalaroror_tilde *x, t_signal **sp)
+{
+ t_sample*in =sp[0]->s_vec;
+ t_sample*out=sp[1]->s_vec;
+ int n =sp[0]->s_n;
+
+#ifdef __SSE__
+ if(
+ Z_SIMD_CHKBLOCKSIZE(n)&&
+ Z_SIMD_CHKALIGN(in)&&
+ Z_SIMD_CHKALIGN(out)
+ )
+ {
+ dsp_add(scalaroror_tilde_performSSE, 4, in, &x->x_g, out, n);
+ } else
+#endif
+ if (n&7)
+ dsp_add(scalaroror_tilde_perform, 4, in, &x->x_g, out, n);
+ else
+ dsp_add(scalaroror_tilde_perf8, 4, in, &x->x_g, out, n);
+}
+
+static void oror_tilde_setup(void)
+{
+ oror_tilde_class = class_new(gensym("||~"), (t_newmethod)oror_tilde_new, 0,
+ sizeof(t_oror_tilde), 0, A_GIMME, 0);
+ class_addmethod(oror_tilde_class, (t_method)oror_tilde_dsp, gensym("dsp"), 0);
+ CLASS_MAINSIGNALIN(oror_tilde_class, t_oror_tilde, x_f);
+ class_sethelpsymbol(oror_tilde_class, gensym("zexy/sigbinops+"));
+ scalaroror_tilde_class = class_new(gensym("||~"), 0, 0,
+ sizeof(t_scalaroror_tilde), 0, 0);
+ CLASS_MAINSIGNALIN(scalaroror_tilde_class, t_scalaroror_tilde, x_f);
+ class_addmethod(scalaroror_tilde_class, (t_method)scalaroror_tilde_dsp, gensym("dsp"),
+ 0);
+ class_sethelpsymbol(scalaroror_tilde_class, gensym("zexy/sigbinops+"));
+ zexy_register("||~");
+}
+
+
+
+/* ---------------------- global setup ------------------------- */
+void z_oror__setup()
+{
+ oror_tilde_setup();
+}
+
+void z_0x7c0x7c0x7e_setup(void)
+{
+ oror_tilde_setup();
+}
+
+void setup_0x7c0x7c0x7e(void)
+{
+ oror_tilde_setup();
+}
+
diff --git a/src/z_sigbin.c b/src/z_sigbin.c
deleted file mode 100644
index 50610f7..0000000
--- a/src/z_sigbin.c
+++ /dev/null
@@ -1,714 +0,0 @@
-/******************************************************
- *
- * zexy - implementation file
- *
- * copyleft (c) IOhannes m zmölnig
- *
- * 1999:forum::für::umläute:2004
- *
- * institute of electronic music and acoustics (iem)
- *
- ******************************************************
- *
- * license: GNU General Public License v.2
- *
- ******************************************************/
-
-/*
- finally :: some of the missing binops for signals :: >~, <~, ==~, &&~, ||~
-
- 1302:forum::für::umläute:2000
-*/
-
-#include "zexy.h"
-
-/* ------------------------ relational~ ----------------------------- */
-
-/* ----------------------------- sigGRT ----------------------------- */
-static t_class *sigGRT_class, *scalarsigGRT_class;
-
-typedef struct _sigGRT
-{
- t_object x_obj;
- float x_f;
-} t_sigGRT;
-
-typedef struct _scalarsigGRT
-{
- t_object x_obj;
- float x_f;
- t_float x_g; /* inlet value */
-} t_scalarsigGRT;
-
-static void *sigGRT_new(t_symbol *s, int argc, t_atom *argv)
-{
- if (argc > 1) post(">~: extra arguments ignored");
- if (argc)
- {
- t_scalarsigGRT *x = (t_scalarsigGRT *)pd_new(scalarsigGRT_class);
- floatinlet_new(&x->x_obj, &x->x_g);
- x->x_g = atom_getfloatarg(0, argc, argv);
- outlet_new(&x->x_obj, &s_signal);
- x->x_f = 0;
- return (x);
- }
- else
- {
- t_sigGRT *x = (t_sigGRT *)pd_new(sigGRT_class);
- inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal);
- outlet_new(&x->x_obj, &s_signal);
- x->x_f = 0;
- return (x);
- }
-}
-
-t_int *sigGRT_perform(t_int *w)
-{
- t_float *in1 = (t_float *)(w[1]);
- t_float *in2 = (t_float *)(w[2]);
- t_float *out = (t_float *)(w[3]);
- int n = (int)(w[4]);
- while (n--) *out++ = *in1++ > *in2++;
- return (w+5);
-}
-
-t_int *sigGRT_perf8(t_int *w)
-{
- t_float *in1 = (t_float *)(w[1]);
- t_float *in2 = (t_float *)(w[2]);
- t_float *out = (t_float *)(w[3]);
- int n = (int)(w[4]);
- for (; n; n -= 8, in1 += 8, in2 += 8, out += 8)
- {
- float f0 = in1[0], f1 = in1[1], f2 = in1[2], f3 = in1[3];
- float f4 = in1[4], f5 = in1[5], f6 = in1[6], f7 = in1[7];
-
- float g0 = in2[0], g1 = in2[1], g2 = in2[2], g3 = in2[3];
- float g4 = in2[4], g5 = in2[5], g6 = in2[6], g7 = in2[7];
-
- out[0] = f0 > g0; out[1] = f1 > g1; out[2] = f2 > g2; out[3] = f3 > g3;
- out[4] = f4 > g4; out[5] = f5 > g5; out[6] = f6 > g6; out[7] = f7 > g7;
- }
- return (w+5);
-}
-
-t_int *scalarsigGRT_perform(t_int *w)
-{
- t_float *in = (t_float *)(w[1]);
- t_float f = *(t_float *)(w[2]);
- t_float *out = (t_float *)(w[3]);
- int n = (int)(w[4]);
- while (n--) *out++ = *in++ > f;
- return (w+5);
-}
-
-t_int *scalarsigGRT_perf8(t_int *w)
-{
- t_float *in = (t_float *)(w[1]);
- t_float g = *(t_float *)(w[2]);
- t_float *out = (t_float *)(w[3]);
- int n = (int)(w[4]);
- for (; n; n -= 8, in += 8, out += 8)
- {
- float f0 = in[0], f1 = in[1], f2 = in[2], f3 = in[3];
- float f4 = in[4], f5 = in[5], f6 = in[6], f7 = in[7];
-
- out[0] = f0 > g; out[1] = f1 > g; out[2] = f2 > g; out[3] = f3 > g;
- out[4] = f4 > g; out[5] = f5 > g; out[6] = f6 > g; out[7] = f7 > g;
- }
- return (w+5);
-}
-
-void dsp_add_sigGRT(t_sample *in1, t_sample *in2, t_sample *out, int n)
-{
- if (n&7)
- dsp_add(sigGRT_perform, 4, in1, in2, out, n);
- else
- dsp_add(sigGRT_perf8, 4, in1, in2, out, n);
-}
-
-static void sigGRT_dsp(t_sigGRT *x, t_signal **sp)
-{
- dsp_add_sigGRT(sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, sp[0]->s_n);
-}
-
-static void scalarsigGRT_dsp(t_scalarsigGRT *x, t_signal **sp)
-{
- if (sp[0]->s_n&7)
- dsp_add(scalarsigGRT_perform, 4, sp[0]->s_vec, &x->x_g,
- sp[1]->s_vec, sp[0]->s_n);
- else
- dsp_add(scalarsigGRT_perf8, 4, sp[0]->s_vec, &x->x_g,
- sp[1]->s_vec, sp[0]->s_n);
-}
-
-static void sigGRT_setup(void)
-{
- sigGRT_class = class_new(gensym(">~"), (t_newmethod)sigGRT_new, 0,
- sizeof(t_sigGRT), 0, A_GIMME, 0);
- class_addmethod(sigGRT_class, (t_method)sigGRT_dsp, gensym("dsp"), 0);
- CLASS_MAINSIGNALIN(sigGRT_class, t_sigGRT, x_f);
- class_sethelpsymbol(sigGRT_class, gensym("zexy/sigbinops+"));
- scalarsigGRT_class = class_new(gensym(">~"), 0, 0,
- sizeof(t_scalarsigGRT), 0, 0);
- CLASS_MAINSIGNALIN(scalarsigGRT_class, t_scalarsigGRT, x_f);
- class_addmethod(scalarsigGRT_class, (t_method)scalarsigGRT_dsp, gensym("dsp"),
- 0);
- class_sethelpsymbol(scalarsigGRT_class, gensym("zexy/sigbinops+"));
-}
-
-
-/* ----------------------------- sigLESS ----------------------------- */
-static t_class *sigLESS_class, *scalarsigLESS_class;
-
-typedef struct _sigLESS
-{
- t_object x_obj;
- float x_f;
-} t_sigLESS;
-
-typedef struct _scalarsigLESS
-{
- t_object x_obj;
- float x_f;
- t_float x_g; /* inlet value */
-} t_scalarsigLESS;
-
-static void *sigLESS_new(t_symbol *s, int argc, t_atom *argv)
-{
- if (argc > 1) post("<~: extra arguments ignored");
- if (argc)
- {
- t_scalarsigLESS *x = (t_scalarsigLESS *)pd_new(scalarsigLESS_class);
- floatinlet_new(&x->x_obj, &x->x_g);
- x->x_g = atom_getfloatarg(0, argc, argv);
- outlet_new(&x->x_obj, &s_signal);
- x->x_f = 0;
- return (x);
- }
- else
- {
- t_sigLESS *x = (t_sigLESS *)pd_new(sigLESS_class);
- inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal);
- outlet_new(&x->x_obj, &s_signal);
- x->x_f = 0;
- return (x);
- }
-}
-
-t_int *sigLESS_perform(t_int *w)
-{
- t_float *in1 = (t_float *)(w[1]);
- t_float *in2 = (t_float *)(w[2]);
- t_float *out = (t_float *)(w[3]);
- int n = (int)(w[4]);
- while (n--) *out++ = *in1++ < *in2++;
- return (w+5);
-}
-
-t_int *sigLESS_perf8(t_int *w)
-{
- t_float *in1 = (t_float *)(w[1]);
- t_float *in2 = (t_float *)(w[2]);
- t_float *out = (t_float *)(w[3]);
- int n = (int)(w[4]);
- for (; n; n -= 8, in1 += 8, in2 += 8, out += 8)
- {
- float f0 = in1[0], f1 = in1[1], f2 = in1[2], f3 = in1[3];
- float f4 = in1[4], f5 = in1[5], f6 = in1[6], f7 = in1[7];
-
- float g0 = in2[0], g1 = in2[1], g2 = in2[2], g3 = in2[3];
- float g4 = in2[4], g5 = in2[5], g6 = in2[6], g7 = in2[7];
-
- out[0] = f0 < g0; out[1] = f1 < g1; out[2] = f2 < g2; out[3] = f3 < g3;
- out[4] = f4 < g4; out[5] = f5 < g5; out[6] = f6 < g6; out[7] = f7 < g7;
- }
- return (w+5);
-}
-
-t_int *scalarsigLESS_perform(t_int *w)
-{
- t_float *in = (t_float *)(w[1]);
- t_float f = *(t_float *)(w[2]);
- t_float *out = (t_float *)(w[3]);
- int n = (int)(w[4]);
- while (n--) *out++ = *in++ < f;
- return (w+5);
-}
-
-t_int *scalarsigLESS_perf8(t_int *w)
-{
- t_float *in = (t_float *)(w[1]);
- t_float g = *(t_float *)(w[2]);
- t_float *out = (t_float *)(w[3]);
- int n = (int)(w[4]);
- for (; n; n -= 8, in += 8, out += 8)
- {
- float f0 = in[0], f1 = in[1], f2 = in[2], f3 = in[3];
- float f4 = in[4], f5 = in[5], f6 = in[6], f7 = in[7];
-
- out[0] = f0 < g; out[1] = f1 < g; out[2] = f2 < g; out[3] = f3 < g;
- out[4] = f4 < g; out[5] = f5 < g; out[6] = f6 < g; out[7] = f7 < g;
- }
- return (w+5);
-}
-
-void dsp_add_sigLESS(t_sample *in1, t_sample *in2, t_sample *out, int n)
-{
- if (n&7)
- dsp_add(sigLESS_perform, 4, in1, in2, out, n);
- else
- dsp_add(sigLESS_perf8, 4, in1, in2, out, n);
-}
-
-static void sigLESS_dsp(t_sigLESS *x, t_signal **sp)
-{
- dsp_add_sigLESS(sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, sp[0]->s_n);
-}
-
-static void scalarsigLESS_dsp(t_scalarsigLESS *x, t_signal **sp)
-{
- if (sp[0]->s_n&7)
- dsp_add(scalarsigLESS_perform, 4, sp[0]->s_vec, &x->x_g,
- sp[1]->s_vec, sp[0]->s_n);
- else
- dsp_add(scalarsigLESS_perf8, 4, sp[0]->s_vec, &x->x_g,
- sp[1]->s_vec, sp[0]->s_n);
-}
-
-static void sigLESS_setup(void)
-{
- sigLESS_class = class_new(gensym("<~"), (t_newmethod)sigLESS_new, 0,
- sizeof(t_sigLESS), 0, A_GIMME, 0);
- class_addmethod(sigLESS_class, (t_method)sigLESS_dsp, gensym("dsp"), 0);
- CLASS_MAINSIGNALIN(sigLESS_class, t_sigLESS, x_f);
- class_sethelpsymbol(sigLESS_class, gensym("zexy/sigbinops+"));
- scalarsigLESS_class = class_new(gensym("<~"), 0, 0,
- sizeof(t_scalarsigLESS), 0, 0);
- CLASS_MAINSIGNALIN(scalarsigLESS_class, t_scalarsigLESS, x_f);
- class_addmethod(scalarsigLESS_class, (t_method)scalarsigLESS_dsp, gensym("dsp"),
- 0);
- class_sethelpsymbol(scalarsigLESS_class, gensym("zexy/sigbinops+"));
-}
-
-/* ----------------------------- sigEQUAL ----------------------------- */
-static t_class *sigEQUAL_class, *scalarsigEQUAL_class;
-
-typedef struct _sigEQUAL
-{
- t_object x_obj;
- float x_f;
-} t_sigEQUAL;
-
-typedef struct _scalarsigEQUAL
-{
- t_object x_obj;
- float x_f;
- t_float x_g; /* inlet value */
-} t_scalarsigEQUAL;
-
-static void *sigEQUAL_new(t_symbol *s, int argc, t_atom *argv)
-{
- if (argc > 1) post("==~: extra arguments ignored");
- if (argc)
- {
- t_scalarsigEQUAL *x = (t_scalarsigEQUAL *)pd_new(scalarsigEQUAL_class);
- floatinlet_new(&x->x_obj, &x->x_g);
- x->x_g = atom_getfloatarg(0, argc, argv);
- outlet_new(&x->x_obj, &s_signal);
- x->x_f = 0;
- return (x);
- }
- else
- {
- t_sigEQUAL *x = (t_sigEQUAL *)pd_new(sigEQUAL_class);
- inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal);
- outlet_new(&x->x_obj, &s_signal);
- x->x_f = 0;
- return (x);
- }
-}
-
-t_int *sigEQUAL_perform(t_int *w)
-{
- t_float *in1 = (t_float *)(w[1]);
- t_float *in2 = (t_float *)(w[2]);
- t_float *out = (t_float *)(w[3]);
- int n = (int)(w[4]);
- while (n--) *out++ = (*in1++ == *in2++);
- return (w+5);
-}
-
-t_int *sigEQUAL_perf8(t_int *w)
-{
- t_float *in1 = (t_float *)(w[1]);
- t_float *in2 = (t_float *)(w[2]);
- t_float *out = (t_float *)(w[3]);
- int n = (int)(w[4]);
- for (; n; n -= 8, in1 += 8, in2 += 8, out += 8)
- {
- float f0 = in1[0], f1 = in1[1], f2 = in1[2], f3 = in1[3];
- float f4 = in1[4], f5 = in1[5], f6 = in1[6], f7 = in1[7];
-
- float g0 = in2[0], g1 = in2[1], g2 = in2[2], g3 = in2[3];
- float g4 = in2[4], g5 = in2[5], g6 = in2[6], g7 = in2[7];
-
- out[0] = f0 == g0; out[1] = f1 == g1; out[2] = f2 == g2; out[3] = f3 == g3;
- out[4] = f4 == g4; out[5] = f5 == g5; out[6] = f6 == g6; out[7] = f7 == g7;
- }
- return (w+5);
-}
-
-t_int *scalarsigEQUAL_perform(t_int *w)
-{
- t_float *in = (t_float *)(w[1]);
- t_float f = *(t_float *)(w[2]);
- t_float *out = (t_float *)(w[3]);
- int n = (int)(w[4]);
- while (n--) *out++ = (*in++ == f);
- return (w+5);
-}
-
-t_int *scalarsigEQUAL_perf8(t_int *w)
-{
- t_float *in = (t_float *)(w[1]);
- t_float g = *(t_float *)(w[2]);
- t_float *out = (t_float *)(w[3]);
- int n = (int)(w[4]);
- for (; n; n -= 8, in += 8, out += 8)
- {
- float f0 = in[0], f1 = in[1], f2 = in[2], f3 = in[3];
- float f4 = in[4], f5 = in[5], f6 = in[6], f7 = in[7];
-
- out[0] = (f0 == g); out[1] = (f1 == g); out[2] = (f2 == g); out[3] = (f3 == g);
- out[4] = (f4 == g); out[5] = (f5 == g); out[6] = (f6 == g); out[7] = (f7 == g);
- }
- return (w+5);
-}
-
-void dsp_add_sigEQUAL(t_sample *in1, t_sample *in2, t_sample *out, int n)
-{
- if (n&7)
- dsp_add(sigEQUAL_perform, 4, in1, in2, out, n);
- else
- dsp_add(sigEQUAL_perf8, 4, in1, in2, out, n);
-}
-
-static void sigEQUAL_dsp(t_sigEQUAL *x, t_signal **sp)
-{
- dsp_add_sigEQUAL(sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, sp[0]->s_n);
-}
-
-static void scalarsigEQUAL_dsp(t_scalarsigEQUAL *x, t_signal **sp)
-{
- if (sp[0]->s_n&7)
- dsp_add(scalarsigEQUAL_perform, 4, sp[0]->s_vec, &x->x_g,
- sp[1]->s_vec, sp[0]->s_n);
- else
- dsp_add(scalarsigEQUAL_perf8, 4, sp[0]->s_vec, &x->x_g,
- sp[1]->s_vec, sp[0]->s_n);
-}
-
-static void sigEQUAL_setup(void)
-{
- sigEQUAL_class = class_new(gensym("==~"), (t_newmethod)sigEQUAL_new, 0,
- sizeof(t_sigEQUAL), 0, A_GIMME, 0);
- class_addmethod(sigEQUAL_class, (t_method)sigEQUAL_dsp, gensym("dsp"), 0);
- CLASS_MAINSIGNALIN(sigEQUAL_class, t_sigEQUAL, x_f);
- class_sethelpsymbol(sigEQUAL_class, gensym("zexy/sigbinops+"));
- scalarsigEQUAL_class = class_new(gensym("==~"), 0, 0,
- sizeof(t_scalarsigEQUAL), 0, 0);
- CLASS_MAINSIGNALIN(scalarsigEQUAL_class, t_scalarsigEQUAL, x_f);
- class_addmethod(scalarsigEQUAL_class, (t_method)scalarsigEQUAL_dsp, gensym("dsp"),
- 0);
- class_sethelpsymbol(scalarsigEQUAL_class, gensym("zexy/sigbinops+"));
-}
-
-/* ------------------------ logical~ ----------------------------- */
-
-/* ----------------------------- sigAND ----------------------------- */
-static t_class *sigAND_class, *scalarsigAND_class;
-
-typedef struct _sigAND
-{
- t_object x_obj;
- float x_f;
-} t_sigAND;
-
-typedef struct _scalarsigAND
-{
- t_object x_obj;
- float x_f;
- t_float x_g; /* inlet value */
-} t_scalarsigAND;
-
-static void *sigAND_new(t_symbol *s, int argc, t_atom *argv)
-{
- if (argc > 1) post("&&~: extra arguments ignored");
- if (argc)
- {
- t_scalarsigAND *x = (t_scalarsigAND *)pd_new(scalarsigAND_class);
- floatinlet_new(&x->x_obj, &x->x_g);
- x->x_g = atom_getfloatarg(0, argc, argv);
- outlet_new(&x->x_obj, &s_signal);
- x->x_f = 0;
- return (x);
- }
- else
- {
- t_sigAND *x = (t_sigAND *)pd_new(sigAND_class);
- inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal);
- outlet_new(&x->x_obj, &s_signal);
- x->x_f = 0;
- return (x);
- }
-}
-
-t_int *sigAND_perform(t_int *w)
-{
- t_float *in1 = (t_float *)(w[1]);
- t_float *in2 = (t_float *)(w[2]);
- t_float *out = (t_float *)(w[3]);
- int n = (int)(w[4]);
- while (n--) *out++ = (int)*in1++ && (int)*in2++;
- return (w+5);
-}
-
-t_int *sigAND_perf8(t_int *w)
-{
- t_float *in1 = (t_float *)(w[1]);
- t_float *in2 = (t_float *)(w[2]);
- t_float *out = (t_float *)(w[3]);
- int n = (int)(w[4]);
- for (; n; n -= 8, in1 += 8, in2 += 8, out += 8)
- {
- int f0 = in1[0], f1 = in1[1], f2 = in1[2], f3 = in1[3];
- int f4 = in1[4], f5 = in1[5], f6 = in1[6], f7 = in1[7];
-
- int g0 = in2[0], g1 = in2[1], g2 = in2[2], g3 = in2[3];
- int g4 = in2[4], g5 = in2[5], g6 = in2[6], g7 = in2[7];
-
- out[0] = f0 && g0; out[1] = f1 && g1; out[2] = f2 && g2; out[3] = f3 && g3;
- out[4] = f4 && g4; out[5] = f5 && g5; out[6] = f6 && g6; out[7] = f7 && g7;
- }
- return (w+5);
-}
-
-t_int *scalarsigAND_perform(t_int *w)
-{
- t_float *in = (t_float *)(w[1]);
- t_float f = *(t_float *)(w[2]);
- t_float *out = (t_float *)(w[3]);
- int n = (int)(w[4]);
- while (n--) *out++ = (int)*in++ && (int)f;
- return (w+5);
-}
-
-t_int *scalarsigAND_perf8(t_int *w)
-{
- t_float *in = (t_float *)(w[1]);
- int g = *(t_float *)(w[2]);
- t_float *out = (t_float *)(w[3]);
- int n = (int)(w[4]);
- for (; n; n -= 8, in += 8, out += 8)
- {
- int f0 = in[0], f1 = in[1], f2 = in[2], f3 = in[3];
- int f4 = in[4], f5 = in[5], f6 = in[6], f7 = in[7];
-
- out[0] = f0 && g; out[1] = f1 && g; out[2] = f2 && g; out[3] = f3 && g;
- out[4] = f4 && g; out[5] = f5 && g; out[6] = f6 && g; out[7] = f7 && g;
- }
- return (w+5);
-}
-
-void dsp_add_sigAND(t_sample *in1, t_sample *in2, t_sample *out, int n)
-{
- if (n&7)
- dsp_add(sigAND_perform, 4, in1, in2, out, n);
- else
- dsp_add(sigAND_perf8, 4, in1, in2, out, n);
-}
-
-static void sigAND_dsp(t_sigAND *x, t_signal **sp)
-{
- dsp_add_sigAND(sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, sp[0]->s_n);
-}
-
-static void scalarsigAND_dsp(t_scalarsigAND *x, t_signal **sp)
-{
- if (sp[0]->s_n&7)
- dsp_add(scalarsigAND_perform, 4, sp[0]->s_vec, &x->x_g,
- sp[1]->s_vec, sp[0]->s_n);
- else
- dsp_add(scalarsigAND_perf8, 4, sp[0]->s_vec, &x->x_g,
- sp[1]->s_vec, sp[0]->s_n);
-}
-
-static void sigAND_setup(void)
-{
- sigAND_class = class_new(gensym("&&~"), (t_newmethod)sigAND_new, 0,
- sizeof(t_sigAND), 0, A_GIMME, 0);
- class_addmethod(sigAND_class, (t_method)sigAND_dsp, gensym("dsp"), 0);
- CLASS_MAINSIGNALIN(sigAND_class, t_sigAND, x_f);
- class_sethelpsymbol(sigAND_class, gensym("zexy/sigbinops+"));
- scalarsigAND_class = class_new(gensym("&&~"), 0, 0,
- sizeof(t_scalarsigAND), 0, 0);
- CLASS_MAINSIGNALIN(scalarsigAND_class, t_scalarsigAND, x_f);
- class_addmethod(scalarsigAND_class, (t_method)scalarsigAND_dsp, gensym("dsp"),
- 0);
- class_sethelpsymbol(scalarsigAND_class, gensym("zexy/sigbinops+"));
-}
-
-
-/* ----------------------------- sigOR ----------------------------- */
-static t_class *sigOR_class, *scalarsigOR_class;
-
-typedef struct _sigOR
-{
- t_object x_obj;
- float x_f;
-} t_sigOR;
-
-typedef struct _scalarsigOR
-{
- t_object x_obj;
- float x_f;
- t_float x_g; /* inlet value */
-} t_scalarsigOR;
-
-static void *sigOR_new(t_symbol *s, int argc, t_atom *argv)
-{
- if (argc > 1) post("||~: extra arguments ignored");
- if (argc)
- {
- t_scalarsigOR *x = (t_scalarsigOR *)pd_new(scalarsigOR_class);
- floatinlet_new(&x->x_obj, &x->x_g);
- x->x_g = atom_getfloatarg(0, argc, argv);
- outlet_new(&x->x_obj, &s_signal);
- x->x_f = 0;
- return (x);
- }
- else
- {
- t_sigOR *x = (t_sigOR *)pd_new(sigOR_class);
- inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal);
- outlet_new(&x->x_obj, &s_signal);
- x->x_f = 0;
- return (x);
- }
-}
-
-t_int *sigOR_perform(t_int *w)
-{
- t_float *in1 = (t_float *)(w[1]);
- t_float *in2 = (t_float *)(w[2]);
- t_float *out = (t_float *)(w[3]);
- int n = (int)(w[4]);
- while (n--) *out++ = (int)*in1++ || (int)*in2++;
- return (w+5);
-}
-
-t_int *sigOR_perf8(t_int *w)
-{
- t_float *in1 = (t_float *)(w[1]);
- t_float *in2 = (t_float *)(w[2]);
- t_float *out = (t_float *)(w[3]);
- int n = (int)(w[4]);
- for (; n; n -= 8, in1 += 8, in2 += 8, out += 8)
- {
- int f0 = in1[0], f1 = in1[1], f2 = in1[2], f3 = in1[3];
- int f4 = in1[4], f5 = in1[5], f6 = in1[6], f7 = in1[7];
-
- int g0 = in2[0], g1 = in2[1], g2 = in2[2], g3 = in2[3];
- int g4 = in2[4], g5 = in2[5], g6 = in2[6], g7 = in2[7];
-
- out[0] = f0 || g0; out[1] = f1 || g1; out[2] = f2 || g2; out[3] = f3 || g3;
- out[4] = f4 || g4; out[5] = f5 || g5; out[6] = f6 || g6; out[7] = f7 || g7;
- }
- return (w+5);
-}
-
-t_int *scalarsigOR_perform(t_int *w)
-{
- t_float *in = (t_float *)(w[1]);
- int f = *(t_float *)(w[2]);
- t_float *out = (t_float *)(w[3]);
- int n = (int)(w[4]);
- while (n--) *out++ = (int)*in++ || f;
- return (w+5);
-}
-
-t_int *scalarsigOR_perf8(t_int *w)
-{
- t_float *in = (t_float *)(w[1]);
- int g = *(t_float *)(w[2]);
- t_float *out = (t_float *)(w[3]);
- int n = (int)(w[4]);
- for (; n; n -= 8, in += 8, out += 8)
- {
- int f0 = in[0], f1 = in[1], f2 = in[2], f3 = in[3];
- int f4 = in[4], f5 = in[5], f6 = in[6], f7 = in[7];
-
- out[0] = f0 || g; out[1] = f1 || g; out[2] = f2 || g; out[3] = f3 || g;
- out[4] = f4 || g; out[5] = f5 || g; out[6] = f6 || g; out[7] = f7 || g;
- }
- return (w+5);
-}
-
-void dsp_add_sigOR(t_sample *in1, t_sample *in2, t_sample *out, int n)
-{
- if (n&7)
- dsp_add(sigOR_perform, 4, in1, in2, out, n);
- else
- dsp_add(sigOR_perf8, 4, in1, in2, out, n);
-}
-
-static void sigOR_dsp(t_sigOR *x, t_signal **sp)
-{
- dsp_add_sigOR(sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, sp[0]->s_n);
-}
-
-static void scalarsigOR_dsp(t_scalarsigOR *x, t_signal **sp)
-{
- if (sp[0]->s_n&7)
- dsp_add(scalarsigOR_perform, 4, sp[0]->s_vec, &x->x_g,
- sp[1]->s_vec, sp[0]->s_n);
- else
- dsp_add(scalarsigOR_perf8, 4, sp[0]->s_vec, &x->x_g,
- sp[1]->s_vec, sp[0]->s_n);
-}
-
-static void sigOR_setup(void)
-{
- sigOR_class = class_new(gensym("||~"), (t_newmethod)sigOR_new, 0,
- sizeof(t_sigOR), 0, A_GIMME, 0);
- class_addmethod(sigOR_class, (t_method)sigOR_dsp, gensym("dsp"), 0);
- CLASS_MAINSIGNALIN(sigOR_class, t_sigOR, x_f);
- class_sethelpsymbol(sigOR_class, gensym("zexy/sigbinops+"));
- scalarsigOR_class = class_new(gensym("||~"), 0, 0,
- sizeof(t_scalarsigOR), 0, 0);
- CLASS_MAINSIGNALIN(scalarsigOR_class, t_scalarsigOR, x_f);
- class_addmethod(scalarsigOR_class, (t_method)scalarsigOR_dsp, gensym("dsp"),
- 0);
- class_sethelpsymbol(scalarsigOR_class, gensym("zexy/sigbinops+"));
-}
-
-
-
-/* ---------------------- global setup ------------------------- */
-
-
-void z_sigbin_setup(void)
-{
- sigGRT_setup();
- sigLESS_setup();
- sigEQUAL_setup();
- sigOR_setup();
- sigAND_setup();
- zexy_register("sigbin");
-}
-void z_z_sigbin_setup(void)
-{
- /* ok, looks a bit like nonsense... */
- z_sigbin_setup();
-}
diff --git a/src/z_zexy.c b/src/z_zexy.c
index e1693c2..b12eeb5 100644
--- a/src/z_zexy.c
+++ b/src/z_zexy.c
@@ -7,6 +7,12 @@
void z_zexy_setup(void)
{
+ z_0x260x260x7e_setup(); /* 0x260x260x7e.c */
+ z_0x2e_setup(); /* 0x2e.c */
+ z_0x3c0x7e_setup(); /* 0x3c0x7e.c */
+ z_0x3d0x3d0x7e_setup(); /* 0x3d0x3d0x7e.c */
+ z_0x3e0x7e_setup(); /* 0x3e0x7e.c */
+ z_0x7c0x7c0x7e_setup(); /* 0x7c0x7c0x7e.c */
z_a2l_setup(); /* a2l.c */
z_absgn__setup(); /* absgn~.c */
z_abs__setup(); /* abs~.c */
@@ -19,7 +25,6 @@ void z_zexy_setup(void)
z_demultiplex__setup(); /* demultiplex~.c */
z_dfreq__setup(); /* dfreq~.c */
z_dirac__setup(); /* dirac~.c */
- z_dot_setup(); /* dot.c */
z_drip_setup(); /* drip.c */
z_envrms__setup(); /* envrms~.c */
z_fifop_setup(); /* fifop.c */
@@ -71,7 +76,6 @@ void z_zexy_setup(void)
z_urn_setup(); /* urn.c */
z_winNT_portio_setup(); /* winNT_portio.c */
z_wrap_setup(); /* wrap.c */
- z_z_sigbin_setup(); /* z_sigbin.c */
z_z__setup(); /* z~.c */
}
diff --git a/src/z_zexy.h b/src/z_zexy.h
index db1419d..e4ad200 100644
--- a/src/z_zexy.h
+++ b/src/z_zexy.h
@@ -5,6 +5,12 @@
#ifndef Z_ZEXY_H__
#define Z_ZEXY_H__
+void z_0x260x260x7e_setup(void); /* 0x260x260x7e.c */
+void z_0x2e_setup(void); /* 0x2e.c */
+void z_0x3c0x7e_setup(void); /* 0x3c0x7e.c */
+void z_0x3d0x3d0x7e_setup(void); /* 0x3d0x3d0x7e.c */
+void z_0x3e0x7e_setup(void); /* 0x3e0x7e.c */
+void z_0x7c0x7c0x7e_setup(void); /* 0x7c0x7c0x7e.c */
void z_a2l_setup(void); /* a2l.c */
void z_absgn__setup(void); /* absgn~.c */
void z_abs__setup(void); /* abs~.c */
@@ -17,7 +23,6 @@ void z_demultiplex_setup(void); /* demultiplex.c */
void z_demultiplex__setup(void); /* demultiplex~.c */
void z_dfreq__setup(void); /* dfreq~.c */
void z_dirac__setup(void); /* dirac~.c */
-void z_dot_setup(void); /* dot.c */
void z_drip_setup(void); /* drip.c */
void z_envrms__setup(void); /* envrms~.c */
void z_fifop_setup(void); /* fifop.c */
@@ -69,7 +74,6 @@ void z_unpack__setup(void); /* unpack~.c */
void z_urn_setup(void); /* urn.c */
void z_winNT_portio_setup(void); /* winNT_portio.c */
void z_wrap_setup(void); /* wrap.c */
-void z_z_sigbin_setup(void); /* z_sigbin.c */
void z_z__setup(void); /* z~.c */
#endif /* Z_ZEXY_H__ */