Fix scvim regsitry file for updated filename (thanks Carlo Capocasa)
[supercollider.git] / server / plugins / BinaryOpUGens.cpp
blobcc7381b4bfefd82d502bf5ee4b1236a7a5215a43
1 /*
2 SuperCollider real time audio synthesis system
3 Copyright (c) 2002 James McCartney. All rights reserved.
4 http://www.audiosynth.com
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 #include "SC_PlugIn.h"
25 #ifdef _MSC_VER
26 // hypotf is c99, but not c++
27 #define hypotf _hypotf
28 #endif
30 #ifdef NOVA_SIMD
31 #include "simd_binary_arithmetic.hpp"
32 #include "simd_math.hpp"
33 #include "simd_memory.hpp"
36 #include "function_attributes.h"
37 using nova::slope_argument;
39 #define NOVA_BINARY_WRAPPER(SCNAME, NOVANAME) \
40 FLATTEN void SCNAME##_aa_nova(BinaryOpUGen *unit, int inNumSamples) \
41 { \
42 nova::NOVANAME##_vec_simd(OUT(0), IN(0), IN(1), inNumSamples); \
43 } \
45 FLATTEN void SCNAME##_aa_nova_64(BinaryOpUGen *unit, int inNumSamples) \
46 { \
47 nova::NOVANAME##_vec_simd<64>(OUT(0), IN(0), IN(1)); \
48 } \
50 FLATTEN void SCNAME##_ia_nova(BinaryOpUGen *unit, int inNumSamples) \
51 { \
52 float xa = ZIN0(0); \
54 nova::NOVANAME##_vec_simd(OUT(0), xa, IN(1), inNumSamples); \
55 unit->mPrevA = xa; \
56 } \
58 FLATTEN void SCNAME##_ia_nova_64(BinaryOpUGen *unit, int inNumSamples) \
59 { \
60 float xa = ZIN0(0); \
62 nova::NOVANAME##_vec_simd<64>(OUT(0), xa, IN(1)); \
63 unit->mPrevA = xa; \
64 } \
66 FLATTEN void SCNAME##_ai_nova(BinaryOpUGen *unit, int inNumSamples) \
67 { \
68 float xb = ZIN0(1); \
70 nova::NOVANAME##_vec_simd(OUT(0), IN(0), xb, inNumSamples); \
71 unit->mPrevB = xb; \
72 } \
74 FLATTEN void SCNAME##_ai_nova_64(BinaryOpUGen *unit, int inNumSamples) \
75 { \
76 float xb = ZIN0(1); \
78 nova::NOVANAME##_vec_simd<64>(OUT(0), IN(0), xb); \
79 unit->mPrevB = xb; \
82 #define NOVA_BINARY_WRAPPER_K(SCNAME, NOVANAME) \
83 FLATTEN void SCNAME##_aa_nova(BinaryOpUGen *unit, int inNumSamples) \
84 { \
85 nova::NOVANAME##_vec_simd(OUT(0), IN(0), IN(1), inNumSamples); \
86 } \
88 FLATTEN void SCNAME##_aa_nova_64(BinaryOpUGen *unit, int inNumSamples) \
89 { \
90 nova::NOVANAME##_vec_simd<64>(OUT(0), IN(0), IN(1)); \
91 } \
93 FLATTEN void SCNAME##_ia_nova(BinaryOpUGen *unit, int inNumSamples) \
94 { \
95 float xa = ZIN0(0); \
97 nova::NOVANAME##_vec_simd(OUT(0), xa, IN(1), inNumSamples); \
98 unit->mPrevA = xa; \
99 } \
101 FLATTEN void SCNAME##_ia_nova_64(BinaryOpUGen *unit, int inNumSamples) \
103 float xa = ZIN0(0); \
105 nova::NOVANAME##_vec_simd<64>(OUT(0), xa, IN(1)); \
106 unit->mPrevA = xa; \
109 FLATTEN void SCNAME##_ai_nova(BinaryOpUGen *unit, int inNumSamples) \
111 float xb = ZIN0(1); \
113 nova::NOVANAME##_vec_simd(OUT(0), IN(0), xb, inNumSamples); \
114 unit->mPrevB = xb; \
117 FLATTEN void SCNAME##_ai_nova_64(BinaryOpUGen *unit, int inNumSamples) \
119 float xb = ZIN0(1); \
121 nova::NOVANAME##_vec_simd<64>(OUT(0), IN(0), xb); \
122 unit->mPrevB = xb; \
125 FLATTEN void SCNAME##_ak_nova(BinaryOpUGen *unit, int inNumSamples) \
127 float xb = unit->mPrevB; \
128 float next_b = ZIN0(1); \
130 if (xb == next_b) { \
131 nova::NOVANAME##_vec_simd(OUT(0), IN(0), xb, inNumSamples); \
132 } else { \
133 float slope = CALCSLOPE(next_b, xb); \
134 nova::NOVANAME##_vec_simd(OUT(0), IN(0), slope_argument(xb, slope), inNumSamples); \
135 unit->mPrevB = next_b; \
139 FLATTEN void SCNAME##_ak_nova_64(BinaryOpUGen *unit, int inNumSamples) \
141 float xb = unit->mPrevB; \
142 float next_b = ZIN0(1); \
144 if (xb == next_b) { \
145 nova::NOVANAME##_vec_simd<64>(OUT(0), IN(0), xb); \
146 } else { \
147 float slope = CALCSLOPE(next_b, xb); \
148 nova::NOVANAME##_vec_simd(OUT(0), IN(0), slope_argument(xb, slope), inNumSamples); \
149 unit->mPrevB = next_b; \
153 FLATTEN void SCNAME##_ka_nova(BinaryOpUGen *unit, int inNumSamples) \
155 float xa = unit->mPrevA; \
156 float next_a = ZIN0(0); \
158 if (xa == next_a) { \
159 nova::NOVANAME##_vec_simd(OUT(0), xa, IN(1), inNumSamples); \
160 } else { \
161 float slope = CALCSLOPE(next_a, xa); \
162 nova::NOVANAME##_vec_simd(OUT(0), slope_argument(xa, slope), IN(1), inNumSamples); \
163 unit->mPrevA = next_a; \
166 FLATTEN void SCNAME##_ka_nova_64(BinaryOpUGen *unit, int inNumSamples) \
168 float xa = unit->mPrevA; \
169 float next_a = ZIN0(0); \
171 if (xa == next_a) { \
172 nova::NOVANAME##_vec_simd<64>(OUT(0), xa, IN(1)); \
173 } else { \
174 float slope = CALCSLOPE(next_a, xa); \
175 nova::NOVANAME##_vec_simd(OUT(0), slope_argument(xa, slope), IN(1), inNumSamples); \
176 unit->mPrevA = next_a; \
181 #endif
183 using namespace std; // for math functions
185 static InterfaceTable *ft;
187 //////////////////////////////////////////////////////////////////////////////////////////////////
190 /* special binary math operators */
191 enum {
192 opAdd,
193 opSub,
194 opMul,
195 opIDiv,
196 opFDiv,
197 opMod,
198 opEQ,
199 opNE,
200 opLT,
201 opGT,
202 opLE,
203 opGE,
204 //opIdentical,
205 //opNotIdentical,
207 opMin,
208 opMax,
209 opBitAnd,
210 opBitOr,
211 opBitXor,
212 opLCM,
213 opGCD,
214 opRound,
215 opRoundUp,
216 opTrunc,
217 opAtan2,
218 opHypot,
219 opHypotx,
220 opPow,
221 opShiftLeft, //
222 opShiftRight, //
223 opUnsignedShift, //
224 opFill, //
225 opRing1, // a * (b + 1) == a * b + a
226 opRing2, // a * b + a + b
227 opRing3, // a*a*b
228 opRing4, // a*a*b - a*b*b
229 opDifSqr, // a*a - b*b
230 opSumSqr, // a*a + b*b
231 opSqrSum, // (a + b)^2
232 opSqrDif, // (a - b)^2
233 opAbsDif, // |a - b|
234 opThresh,
235 opAMClip,
236 opScaleNeg,
237 opClip2,
238 opExcess,
239 opFold2,
240 opWrap2,
241 opFirstArg,
242 opRandRange,
243 opExpRandRange,
245 opNumBinarySelectors
249 inline float sc_andt(float a, float b)
251 return int(a) & int(b);
254 inline float sc_ort(float a, float b)
256 return int(a) | int(b);
259 inline float sc_xort(float a, float b)
261 return int(a) ^ int(b);
264 inline float sc_rst(float a, float b)
266 return int(a) >> int(b);
269 inline float sc_lst(float a, float b)
271 return int(a) << int(b);
274 struct BinaryOpUGen : public Unit
276 float mPrevA, mPrevB;
279 typedef void (*BinaryOpFunc)(BinaryOpUGen *unit, int inNumSamples);
281 extern "C"
284 void BinaryOpUGen_Ctor(BinaryOpUGen *unit);
286 //void zero_d(BinaryOpUGen *unit, int inNumSamples);
287 void zero_1(BinaryOpUGen *unit, int inNumSamples);
288 void zero_aa(BinaryOpUGen *unit, int inNumSamples);
289 void firstarg_d(BinaryOpUGen *unit, int inNumSamples);
290 void firstarg_1(BinaryOpUGen *unit, int inNumSamples);
291 void firstarg_aa(BinaryOpUGen *unit, int inNumSamples);
292 void secondarg_d(BinaryOpUGen *unit, int inNumSamples);
293 void secondarg_1(BinaryOpUGen *unit, int inNumSamples);
294 void secondarg_aa(BinaryOpUGen *unit, int inNumSamples);
295 void add_d(BinaryOpUGen *unit, int inNumSamples);
296 void add_1(BinaryOpUGen *unit, int inNumSamples);
297 void add_aa(BinaryOpUGen *unit, int inNumSamples);
298 void add_ak(BinaryOpUGen *unit, int inNumSamples);
299 void add_ka(BinaryOpUGen *unit, int inNumSamples);
300 void add_ai(BinaryOpUGen *unit, int inNumSamples);
301 void add_ia(BinaryOpUGen *unit, int inNumSamples);
302 void sub_d(BinaryOpUGen *unit, int inNumSamples);
303 void sub_1(BinaryOpUGen *unit, int inNumSamples);
304 void sub_aa(BinaryOpUGen *unit, int inNumSamples);
305 void sub_ak(BinaryOpUGen *unit, int inNumSamples);
306 void sub_ka(BinaryOpUGen *unit, int inNumSamples);
307 void sub_ai(BinaryOpUGen *unit, int inNumSamples);
308 void sub_ia(BinaryOpUGen *unit, int inNumSamples);
309 void mul_d(BinaryOpUGen *unit, int inNumSamples);
310 void mul_1(BinaryOpUGen *unit, int inNumSamples);
311 void mul_aa(BinaryOpUGen *unit, int inNumSamples);
312 void mul_ak(BinaryOpUGen *unit, int inNumSamples);
313 void mul_ka(BinaryOpUGen *unit, int inNumSamples);
314 void mul_ai(BinaryOpUGen *unit, int inNumSamples);
315 void mul_ia(BinaryOpUGen *unit, int inNumSamples);
316 void div_d(BinaryOpUGen *unit, int inNumSamples);
317 void div_1(BinaryOpUGen *unit, int inNumSamples);
318 void div_aa(BinaryOpUGen *unit, int inNumSamples);
319 void div_ak(BinaryOpUGen *unit, int inNumSamples);
320 void div_ka(BinaryOpUGen *unit, int inNumSamples);
321 void div_ai(BinaryOpUGen *unit, int inNumSamples);
322 void div_ia(BinaryOpUGen *unit, int inNumSamples);
323 void mod_d(BinaryOpUGen *unit, int inNumSamples);
324 void mod_1(BinaryOpUGen *unit, int inNumSamples);
325 void mod_aa(BinaryOpUGen *unit, int inNumSamples);
326 void mod_ak(BinaryOpUGen *unit, int inNumSamples);
327 void mod_ka(BinaryOpUGen *unit, int inNumSamples);
328 void mod_ai(BinaryOpUGen *unit, int inNumSamples);
329 void mod_ia(BinaryOpUGen *unit, int inNumSamples);
330 void max_d(BinaryOpUGen *unit, int inNumSamples);
331 void max_1(BinaryOpUGen *unit, int inNumSamples);
332 void max_aa(BinaryOpUGen *unit, int inNumSamples);
333 void max_ak(BinaryOpUGen *unit, int inNumSamples);
334 void max_ka(BinaryOpUGen *unit, int inNumSamples);
335 void max_ai(BinaryOpUGen *unit, int inNumSamples);
336 void max_ia(BinaryOpUGen *unit, int inNumSamples);
337 void min_d(BinaryOpUGen *unit, int inNumSamples);
338 void min_1(BinaryOpUGen *unit, int inNumSamples);
339 void min_aa(BinaryOpUGen *unit, int inNumSamples);
340 void min_ak(BinaryOpUGen *unit, int inNumSamples);
341 void min_ka(BinaryOpUGen *unit, int inNumSamples);
342 void min_ai(BinaryOpUGen *unit, int inNumSamples);
343 void min_ia(BinaryOpUGen *unit, int inNumSamples);
345 void and_d(BinaryOpUGen *unit, int inNumSamples);
346 void and_1(BinaryOpUGen *unit, int inNumSamples);
347 void and_aa(BinaryOpUGen *unit, int inNumSamples);
348 void and_ak(BinaryOpUGen *unit, int inNumSamples);
349 void and_ka(BinaryOpUGen *unit, int inNumSamples);
350 void and_ai(BinaryOpUGen *unit, int inNumSamples);
351 void and_ia(BinaryOpUGen *unit, int inNumSamples);
353 void or_d(BinaryOpUGen *unit, int inNumSamples);
354 void or_1(BinaryOpUGen *unit, int inNumSamples);
355 void or_aa(BinaryOpUGen *unit, int inNumSamples);
356 void or_ak(BinaryOpUGen *unit, int inNumSamples);
357 void or_ka(BinaryOpUGen *unit, int inNumSamples);
358 void or_ai(BinaryOpUGen *unit, int inNumSamples);
359 void or_ia(BinaryOpUGen *unit, int inNumSamples);
361 void xor_d(BinaryOpUGen *unit, int inNumSamples);
362 void xor_1(BinaryOpUGen *unit, int inNumSamples);
363 void xor_aa(BinaryOpUGen *unit, int inNumSamples);
364 void xor_ak(BinaryOpUGen *unit, int inNumSamples);
365 void xor_ka(BinaryOpUGen *unit, int inNumSamples);
366 void xor_ai(BinaryOpUGen *unit, int inNumSamples);
367 void xor_ia(BinaryOpUGen *unit, int inNumSamples);
369 void amclip_d(BinaryOpUGen *unit, int inNumSamples);
370 void amclip_1(BinaryOpUGen *unit, int inNumSamples);
371 void amclip_aa(BinaryOpUGen *unit, int inNumSamples);
372 void amclip_ak(BinaryOpUGen *unit, int inNumSamples);
373 void amclip_ka(BinaryOpUGen *unit, int inNumSamples);
374 void amclip_ai(BinaryOpUGen *unit, int inNumSamples);
375 void amclip_ia(BinaryOpUGen *unit, int inNumSamples);
376 void scaleneg_d(BinaryOpUGen *unit, int inNumSamples);
377 void scaleneg_1(BinaryOpUGen *unit, int inNumSamples);
378 void scaleneg_aa(BinaryOpUGen *unit, int inNumSamples);
379 void scaleneg_ak(BinaryOpUGen *unit, int inNumSamples);
380 void scaleneg_ka(BinaryOpUGen *unit, int inNumSamples);
381 void scaleneg_ai(BinaryOpUGen *unit, int inNumSamples);
382 void scaleneg_ia(BinaryOpUGen *unit, int inNumSamples);
383 void pow_d(BinaryOpUGen *unit, int inNumSamples);
384 void pow_1(BinaryOpUGen *unit, int inNumSamples);
385 void pow_aa(BinaryOpUGen *unit, int inNumSamples);
386 void pow_ak(BinaryOpUGen *unit, int inNumSamples);
387 void pow_ka(BinaryOpUGen *unit, int inNumSamples);
388 void pow_ai(BinaryOpUGen *unit, int inNumSamples);
389 void pow_ia(BinaryOpUGen *unit, int inNumSamples);
390 void ring1_d(BinaryOpUGen *unit, int inNumSamples);
391 void ring1_1(BinaryOpUGen *unit, int inNumSamples);
392 void ring1_aa(BinaryOpUGen *unit, int inNumSamples);
393 void ring1_ak(BinaryOpUGen *unit, int inNumSamples);
394 void ring1_ka(BinaryOpUGen *unit, int inNumSamples);
395 void ring1_ai(BinaryOpUGen *unit, int inNumSamples);
396 void ring1_ia(BinaryOpUGen *unit, int inNumSamples);
397 void ring2_d(BinaryOpUGen *unit, int inNumSamples);
398 void ring2_1(BinaryOpUGen *unit, int inNumSamples);
399 void ring2_aa(BinaryOpUGen *unit, int inNumSamples);
400 void ring2_ak(BinaryOpUGen *unit, int inNumSamples);
401 void ring2_ka(BinaryOpUGen *unit, int inNumSamples);
402 void ring2_ai(BinaryOpUGen *unit, int inNumSamples);
403 void ring2_ia(BinaryOpUGen *unit, int inNumSamples);
404 void ring3_d(BinaryOpUGen *unit, int inNumSamples);
405 void ring3_1(BinaryOpUGen *unit, int inNumSamples);
406 void ring3_aa(BinaryOpUGen *unit, int inNumSamples);
407 void ring3_ak(BinaryOpUGen *unit, int inNumSamples);
408 void ring3_ka(BinaryOpUGen *unit, int inNumSamples);
409 void ring3_ai(BinaryOpUGen *unit, int inNumSamples);
410 void ring3_ia(BinaryOpUGen *unit, int inNumSamples);
411 void ring4_d(BinaryOpUGen *unit, int inNumSamples);
412 void ring4_1(BinaryOpUGen *unit, int inNumSamples);
413 void ring4_aa(BinaryOpUGen *unit, int inNumSamples);
414 void ring4_ak(BinaryOpUGen *unit, int inNumSamples);
415 void ring4_ka(BinaryOpUGen *unit, int inNumSamples);
416 void ring4_ai(BinaryOpUGen *unit, int inNumSamples);
417 void ring4_ia(BinaryOpUGen *unit, int inNumSamples);
418 void thresh_d(BinaryOpUGen *unit, int inNumSamples);
419 void thresh_1(BinaryOpUGen *unit, int inNumSamples);
420 void thresh_aa(BinaryOpUGen *unit, int inNumSamples);
421 void thresh_ak(BinaryOpUGen *unit, int inNumSamples);
422 void thresh_ka(BinaryOpUGen *unit, int inNumSamples);
423 void thresh_ai(BinaryOpUGen *unit, int inNumSamples);
424 void thresh_ia(BinaryOpUGen *unit, int inNumSamples);
425 void clip2_d(BinaryOpUGen *unit, int inNumSamples);
426 void clip2_1(BinaryOpUGen *unit, int inNumSamples);
427 void clip2_aa(BinaryOpUGen *unit, int inNumSamples);
428 void clip2_ak(BinaryOpUGen *unit, int inNumSamples);
429 void clip2_ka(BinaryOpUGen *unit, int inNumSamples);
430 void clip2_ai(BinaryOpUGen *unit, int inNumSamples);
431 void clip2_ia(BinaryOpUGen *unit, int inNumSamples);
432 void fold2_d(BinaryOpUGen *unit, int inNumSamples);
433 void fold2_1(BinaryOpUGen *unit, int inNumSamples);
434 void fold2_aa(BinaryOpUGen *unit, int inNumSamples);
435 void fold2_ak(BinaryOpUGen *unit, int inNumSamples);
436 void fold2_ka(BinaryOpUGen *unit, int inNumSamples);
437 void fold2_ai(BinaryOpUGen *unit, int inNumSamples);
438 void fold2_ia(BinaryOpUGen *unit, int inNumSamples);
439 void wrap2_d(BinaryOpUGen *unit, int inNumSamples);
440 void wrap2_1(BinaryOpUGen *unit, int inNumSamples);
441 void wrap2_aa(BinaryOpUGen *unit, int inNumSamples);
442 void wrap2_ak(BinaryOpUGen *unit, int inNumSamples);
443 void wrap2_ka(BinaryOpUGen *unit, int inNumSamples);
444 void wrap2_ai(BinaryOpUGen *unit, int inNumSamples);
445 void wrap2_ia(BinaryOpUGen *unit, int inNumSamples);
446 void excess_d(BinaryOpUGen *unit, int inNumSamples);
447 void excess_1(BinaryOpUGen *unit, int inNumSamples);
448 void excess_aa(BinaryOpUGen *unit, int inNumSamples);
449 void excess_ak(BinaryOpUGen *unit, int inNumSamples);
450 void excess_ka(BinaryOpUGen *unit, int inNumSamples);
451 void excess_ai(BinaryOpUGen *unit, int inNumSamples);
452 void excess_ia(BinaryOpUGen *unit, int inNumSamples);
453 void lt_d(BinaryOpUGen *unit, int inNumSamples);
454 void lt_1(BinaryOpUGen *unit, int inNumSamples);
455 void lt_aa(BinaryOpUGen *unit, int inNumSamples);
456 void lt_ak(BinaryOpUGen *unit, int inNumSamples);
457 void lt_ka(BinaryOpUGen *unit, int inNumSamples);
458 void lt_ai(BinaryOpUGen *unit, int inNumSamples);
459 void lt_ia(BinaryOpUGen *unit, int inNumSamples);
460 void le_d(BinaryOpUGen *unit, int inNumSamples);
461 void le_1(BinaryOpUGen *unit, int inNumSamples);
462 void le_aa(BinaryOpUGen *unit, int inNumSamples);
463 void le_ak(BinaryOpUGen *unit, int inNumSamples);
464 void le_ka(BinaryOpUGen *unit, int inNumSamples);
465 void le_ai(BinaryOpUGen *unit, int inNumSamples);
466 void le_ia(BinaryOpUGen *unit, int inNumSamples);
467 void gt_d(BinaryOpUGen *unit, int inNumSamples);
468 void gt_1(BinaryOpUGen *unit, int inNumSamples);
469 void gt_aa(BinaryOpUGen *unit, int inNumSamples);
470 void gt_ak(BinaryOpUGen *unit, int inNumSamples);
471 void gt_ka(BinaryOpUGen *unit, int inNumSamples);
472 void gt_ai(BinaryOpUGen *unit, int inNumSamples);
473 void gt_ia(BinaryOpUGen *unit, int inNumSamples);
474 void ge_d(BinaryOpUGen *unit, int inNumSamples);
475 void ge_1(BinaryOpUGen *unit, int inNumSamples);
476 void ge_aa(BinaryOpUGen *unit, int inNumSamples);
477 void ge_ak(BinaryOpUGen *unit, int inNumSamples);
478 void ge_ka(BinaryOpUGen *unit, int inNumSamples);
479 void ge_ai(BinaryOpUGen *unit, int inNumSamples);
480 void ge_ia(BinaryOpUGen *unit, int inNumSamples);
481 void eq_d(BinaryOpUGen *unit, int inNumSamples);
482 void eq_1(BinaryOpUGen *unit, int inNumSamples);
483 void eq_aa(BinaryOpUGen *unit, int inNumSamples);
484 void eq_ak(BinaryOpUGen *unit, int inNumSamples);
485 void eq_ka(BinaryOpUGen *unit, int inNumSamples);
486 void eq_ai(BinaryOpUGen *unit, int inNumSamples);
487 void eq_ia(BinaryOpUGen *unit, int inNumSamples);
488 void neq_d(BinaryOpUGen *unit, int inNumSamples);
489 void neq_1(BinaryOpUGen *unit, int inNumSamples);
490 void neq_aa(BinaryOpUGen *unit, int inNumSamples);
491 void neq_ak(BinaryOpUGen *unit, int inNumSamples);
492 void neq_ka(BinaryOpUGen *unit, int inNumSamples);
493 void neq_ai(BinaryOpUGen *unit, int inNumSamples);
494 void neq_ia(BinaryOpUGen *unit, int inNumSamples);
495 void sumsqr_d(BinaryOpUGen *unit, int inNumSamples);
496 void sumsqr_1(BinaryOpUGen *unit, int inNumSamples);
497 void sumsqr_aa(BinaryOpUGen *unit, int inNumSamples);
498 void sumsqr_ak(BinaryOpUGen *unit, int inNumSamples);
499 void sumsqr_ka(BinaryOpUGen *unit, int inNumSamples);
500 void sumsqr_ai(BinaryOpUGen *unit, int inNumSamples);
501 void sumsqr_ia(BinaryOpUGen *unit, int inNumSamples);
502 void difsqr_d(BinaryOpUGen *unit, int inNumSamples);
503 void difsqr_1(BinaryOpUGen *unit, int inNumSamples);
504 void difsqr_aa(BinaryOpUGen *unit, int inNumSamples);
505 void difsqr_ak(BinaryOpUGen *unit, int inNumSamples);
506 void difsqr_ka(BinaryOpUGen *unit, int inNumSamples);
507 void difsqr_ai(BinaryOpUGen *unit, int inNumSamples);
508 void difsqr_ia(BinaryOpUGen *unit, int inNumSamples);
509 void sqrsum_d(BinaryOpUGen *unit, int inNumSamples);
510 void sqrsum_1(BinaryOpUGen *unit, int inNumSamples);
511 void sqrsum_aa(BinaryOpUGen *unit, int inNumSamples);
512 void sqrsum_ak(BinaryOpUGen *unit, int inNumSamples);
513 void sqrsum_ka(BinaryOpUGen *unit, int inNumSamples);
514 void sqrsum_ai(BinaryOpUGen *unit, int inNumSamples);
515 void sqrsum_ia(BinaryOpUGen *unit, int inNumSamples);
516 void sqrdif_d(BinaryOpUGen *unit, int inNumSamples);
517 void sqrdif_1(BinaryOpUGen *unit, int inNumSamples);
518 void sqrdif_aa(BinaryOpUGen *unit, int inNumSamples);
519 void sqrdif_ak(BinaryOpUGen *unit, int inNumSamples);
520 void sqrdif_ka(BinaryOpUGen *unit, int inNumSamples);
521 void sqrdif_ai(BinaryOpUGen *unit, int inNumSamples);
522 void sqrdif_ia(BinaryOpUGen *unit, int inNumSamples);
523 void absdif_d(BinaryOpUGen *unit, int inNumSamples);
524 void absdif_1(BinaryOpUGen *unit, int inNumSamples);
525 void absdif_aa(BinaryOpUGen *unit, int inNumSamples);
526 void absdif_ak(BinaryOpUGen *unit, int inNumSamples);
527 void absdif_ka(BinaryOpUGen *unit, int inNumSamples);
528 void absdif_ai(BinaryOpUGen *unit, int inNumSamples);
529 void absdif_ia(BinaryOpUGen *unit, int inNumSamples);
530 void round_d(BinaryOpUGen *unit, int inNumSamples);
531 void round_1(BinaryOpUGen *unit, int inNumSamples);
532 void round_aa(BinaryOpUGen *unit, int inNumSamples);
533 void round_ak(BinaryOpUGen *unit, int inNumSamples);
534 void round_ka(BinaryOpUGen *unit, int inNumSamples);
535 void round_ai(BinaryOpUGen *unit, int inNumSamples);
536 void round_ia(BinaryOpUGen *unit, int inNumSamples);
537 void roundUp_d(BinaryOpUGen *unit, int inNumSamples);
538 void roundUp_1(BinaryOpUGen *unit, int inNumSamples);
539 void roundUp_aa(BinaryOpUGen *unit, int inNumSamples);
540 void roundUp_ak(BinaryOpUGen *unit, int inNumSamples);
541 void roundUp_ka(BinaryOpUGen *unit, int inNumSamples);
542 void roundUp_ai(BinaryOpUGen *unit, int inNumSamples);
543 void roundUp_ia(BinaryOpUGen *unit, int inNumSamples);
544 void trunc_d(BinaryOpUGen *unit, int inNumSamples);
545 void trunc_1(BinaryOpUGen *unit, int inNumSamples);
546 void trunc_aa(BinaryOpUGen *unit, int inNumSamples);
547 void trunc_ak(BinaryOpUGen *unit, int inNumSamples);
548 void trunc_ka(BinaryOpUGen *unit, int inNumSamples);
549 void trunc_ai(BinaryOpUGen *unit, int inNumSamples);
550 void trunc_ia(BinaryOpUGen *unit, int inNumSamples);
551 void atan2_d(BinaryOpUGen *unit, int inNumSamples);
552 void atan2_1(BinaryOpUGen *unit, int inNumSamples);
553 void atan2_aa(BinaryOpUGen *unit, int inNumSamples);
554 void atan2_ak(BinaryOpUGen *unit, int inNumSamples);
555 void atan2_ka(BinaryOpUGen *unit, int inNumSamples);
556 void atan2_ai(BinaryOpUGen *unit, int inNumSamples);
557 void atan2_ia(BinaryOpUGen *unit, int inNumSamples);
558 void hypot_d(BinaryOpUGen *unit, int inNumSamples);
559 void hypot_1(BinaryOpUGen *unit, int inNumSamples);
560 void hypot_aa(BinaryOpUGen *unit, int inNumSamples);
561 void hypot_ak(BinaryOpUGen *unit, int inNumSamples);
562 void hypot_ka(BinaryOpUGen *unit, int inNumSamples);
563 void hypot_ai(BinaryOpUGen *unit, int inNumSamples);
564 void hypot_ia(BinaryOpUGen *unit, int inNumSamples);
565 void hypotx_d(BinaryOpUGen *unit, int inNumSamples);
566 void hypotx_1(BinaryOpUGen *unit, int inNumSamples);
567 void hypotx_aa(BinaryOpUGen *unit, int inNumSamples);
568 void hypotx_ak(BinaryOpUGen *unit, int inNumSamples);
569 void hypotx_ka(BinaryOpUGen *unit, int inNumSamples);
570 void hypotx_ai(BinaryOpUGen *unit, int inNumSamples);
571 void hypotx_ia(BinaryOpUGen *unit, int inNumSamples);
574 ////////////////////////////////////////////////////////////////////////////////////////////////////////
576 static bool ChooseOperatorFunc(BinaryOpUGen *unit);
578 void BinaryOpUGen_Ctor(BinaryOpUGen *unit)
580 unit->mPrevA = ZIN0(0);
581 unit->mPrevB = ZIN0(1);
582 bool initialized = ChooseOperatorFunc(unit);
583 if (unit->mCalcRate == calc_DemandRate) {
584 OUT0(0) = 0.f;
585 } else {
586 if (!initialized)
587 (unit->mCalcFunc)(unit, 1);
592 void zero_d(BinaryOpUGen *unit, int inNumSamples)
594 if (inNumSamples) {
595 float a = DEMANDINPUT_A(0, inNumSamples);
596 float b = DEMANDINPUT_A(1, inNumSamples);
597 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : 0.f;
598 } else {
599 RESETINPUT(0);
600 RESETINPUT(1);
605 void firstarg_d(BinaryOpUGen *unit, int inNumSamples)
607 if (inNumSamples) {
608 float a = DEMANDINPUT_A(0, inNumSamples);
609 float b = DEMANDINPUT_A(1, inNumSamples);
610 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : a;
611 } else {
612 RESETINPUT(0);
613 RESETINPUT(1);
617 void secondarg_d(BinaryOpUGen *unit, int inNumSamples)
619 if (inNumSamples) {
620 float a = DEMANDINPUT_A(0, inNumSamples);
621 float b = DEMANDINPUT_A(1, inNumSamples);
622 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : b;
623 } else {
624 RESETINPUT(0);
625 RESETINPUT(1);
629 void add_d(BinaryOpUGen *unit, int inNumSamples)
631 if (inNumSamples) {
632 float a = DEMANDINPUT_A(0, inNumSamples);
633 float b = DEMANDINPUT_A(1, inNumSamples);
634 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : a + b;
635 } else {
636 RESETINPUT(0);
637 RESETINPUT(1);
641 void sub_d(BinaryOpUGen *unit, int inNumSamples)
643 if (inNumSamples) {
644 float a = DEMANDINPUT_A(0, inNumSamples);
645 float b = DEMANDINPUT_A(1, inNumSamples);
646 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : a - b;
647 } else {
648 RESETINPUT(0);
649 RESETINPUT(1);
653 void mul_d(BinaryOpUGen *unit, int inNumSamples)
655 if (inNumSamples) {
656 float a = DEMANDINPUT_A(0, inNumSamples);
657 float b = DEMANDINPUT_A(1, inNumSamples);
658 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : a * b;
659 } else {
660 RESETINPUT(0);
661 RESETINPUT(1);
665 void div_d(BinaryOpUGen *unit, int inNumSamples)
667 if (inNumSamples) {
668 float a = DEMANDINPUT_A(0, inNumSamples);
669 float b = DEMANDINPUT_A(1, inNumSamples);
670 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : a / b;
671 } else {
672 RESETINPUT(0);
673 RESETINPUT(1);
677 void mod_d(BinaryOpUGen *unit, int inNumSamples)
679 if (inNumSamples) {
680 float a = DEMANDINPUT_A(0, inNumSamples);
681 float b = DEMANDINPUT_A(1, inNumSamples);
682 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : sc_mod(a, b);
683 } else {
684 RESETINPUT(0);
685 RESETINPUT(1);
689 void max_d(BinaryOpUGen *unit, int inNumSamples)
691 if (inNumSamples) {
692 float a = DEMANDINPUT_A(0, inNumSamples);
693 float b = DEMANDINPUT_A(1, inNumSamples);
694 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : sc_max(a, b);
695 } else {
696 RESETINPUT(0);
697 RESETINPUT(1);
701 void min_d(BinaryOpUGen *unit, int inNumSamples)
703 if (inNumSamples) {
704 float a = DEMANDINPUT_A(0, inNumSamples);
705 float b = DEMANDINPUT_A(1, inNumSamples);
706 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : sc_min(a, b);
707 } else {
708 RESETINPUT(0);
709 RESETINPUT(1);
713 void and_d(BinaryOpUGen *unit, int inNumSamples)
715 if (inNumSamples) {
716 float a = DEMANDINPUT_A(0, inNumSamples);
717 float b = DEMANDINPUT_A(1, inNumSamples);
718 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : sc_andt(a, b);
719 } else {
720 RESETINPUT(0);
721 RESETINPUT(1);
725 void or_d(BinaryOpUGen *unit, int inNumSamples)
727 if (inNumSamples) {
728 float a = DEMANDINPUT_A(0, inNumSamples);
729 float b = DEMANDINPUT_A(1, inNumSamples);
730 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : sc_ort(a, b);
731 } else {
732 RESETINPUT(0);
733 RESETINPUT(1);
737 void xor_d(BinaryOpUGen *unit, int inNumSamples)
739 if (inNumSamples) {
740 float a = DEMANDINPUT_A(0, inNumSamples);
741 float b = DEMANDINPUT_A(1, inNumSamples);
742 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : sc_xort(a, b);
743 } else {
744 RESETINPUT(0);
745 RESETINPUT(1);
749 void rightShift_d(BinaryOpUGen *unit, int inNumSamples)
751 if (inNumSamples) {
752 float a = DEMANDINPUT_A(0, inNumSamples);
753 float b = DEMANDINPUT_A(1, inNumSamples);
754 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : sc_rst(a, b);
755 } else {
756 RESETINPUT(0);
757 RESETINPUT(1);
761 void leftShift_d(BinaryOpUGen *unit, int inNumSamples)
763 if (inNumSamples) {
764 float a = DEMANDINPUT_A(0, inNumSamples);
765 float b = DEMANDINPUT_A(1, inNumSamples);
766 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : sc_lst(a, b);
767 } else {
768 RESETINPUT(0);
769 RESETINPUT(1);
773 void amclip_d(BinaryOpUGen *unit, int inNumSamples)
775 if (inNumSamples) {
776 float a = DEMANDINPUT_A(0, inNumSamples);
777 float b = DEMANDINPUT_A(1, inNumSamples);
778 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : sc_amclip(a, b);
779 } else {
780 RESETINPUT(0);
781 RESETINPUT(1);
785 void scaleneg_d(BinaryOpUGen *unit, int inNumSamples)
787 if (inNumSamples) {
788 float a = DEMANDINPUT_A(0, inNumSamples);
789 float b = DEMANDINPUT_A(1, inNumSamples);
790 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : sc_scaleneg(a, b);
791 } else {
792 RESETINPUT(0);
793 RESETINPUT(1);
797 void pow_d(BinaryOpUGen *unit, int inNumSamples)
799 if (inNumSamples) {
800 float a = DEMANDINPUT_A(0, inNumSamples);
801 float b = DEMANDINPUT_A(1, inNumSamples);
802 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : (a < 0.f ? -pow(-a, b) : pow(a, b));
803 } else {
804 RESETINPUT(0);
805 RESETINPUT(1);
809 void ring1_d(BinaryOpUGen *unit, int inNumSamples)
811 if (inNumSamples) {
812 float a = DEMANDINPUT_A(0, inNumSamples);
813 float b = DEMANDINPUT_A(1, inNumSamples);
814 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : a * b + a;
815 } else {
816 RESETINPUT(0);
817 RESETINPUT(1);
821 void ring2_d(BinaryOpUGen *unit, int inNumSamples)
823 if (inNumSamples) {
824 float a = DEMANDINPUT_A(0, inNumSamples);
825 float b = DEMANDINPUT_A(1, inNumSamples);
826 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : a * b + a + b;
827 } else {
828 RESETINPUT(0);
829 RESETINPUT(1);
833 void ring3_d(BinaryOpUGen *unit, int inNumSamples)
835 if (inNumSamples) {
836 float a = DEMANDINPUT_A(0, inNumSamples);
837 float b = DEMANDINPUT_A(1, inNumSamples);
838 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : a * a * b;
839 } else {
840 RESETINPUT(0);
841 RESETINPUT(1);
845 void ring4_d(BinaryOpUGen *unit, int inNumSamples)
847 if (inNumSamples) {
848 float a = DEMANDINPUT_A(0, inNumSamples);
849 float b = DEMANDINPUT_A(1, inNumSamples);
850 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : a * a * b - a * b * b;
851 } else {
852 RESETINPUT(0);
853 RESETINPUT(1);
857 void thresh_d(BinaryOpUGen *unit, int inNumSamples)
859 if (inNumSamples) {
860 float a = DEMANDINPUT_A(0, inNumSamples);
861 float b = DEMANDINPUT_A(1, inNumSamples);
862 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : sc_thresh(a, b);
863 } else {
864 RESETINPUT(0);
865 RESETINPUT(1);
869 void clip2_d(BinaryOpUGen *unit, int inNumSamples)
871 if (inNumSamples) {
872 float a = DEMANDINPUT_A(0, inNumSamples);
873 float b = DEMANDINPUT_A(1, inNumSamples);
874 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : sc_clip2(a, b);
875 } else {
876 RESETINPUT(0);
877 RESETINPUT(1);
881 void excess_d(BinaryOpUGen *unit, int inNumSamples)
883 if (inNumSamples) {
884 float a = DEMANDINPUT_A(0, inNumSamples);
885 float b = DEMANDINPUT_A(1, inNumSamples);
886 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : sc_excess(a, b);
887 } else {
888 RESETINPUT(0);
889 RESETINPUT(1);
893 void lt_d(BinaryOpUGen *unit, int inNumSamples)
895 if (inNumSamples) {
896 float a = DEMANDINPUT_A(0, inNumSamples);
897 float b = DEMANDINPUT_A(1, inNumSamples);
898 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : (a < b ? 1.f : 0.f);
899 } else {
900 RESETINPUT(0);
901 RESETINPUT(1);
905 void gt_d(BinaryOpUGen *unit, int inNumSamples)
907 if (inNumSamples) {
908 float a = DEMANDINPUT_A(0, inNumSamples);
909 float b = DEMANDINPUT_A(1, inNumSamples);
910 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : (a > b ? 1.f : 0.f);
911 } else {
912 RESETINPUT(0);
913 RESETINPUT(1);
917 void le_d(BinaryOpUGen *unit, int inNumSamples)
919 if (inNumSamples) {
920 float a = DEMANDINPUT_A(0, inNumSamples);
921 float b = DEMANDINPUT_A(1, inNumSamples);
922 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : (a <= b ? 1.f : 0.f);
923 } else {
924 RESETINPUT(0);
925 RESETINPUT(1);
929 void ge_d(BinaryOpUGen *unit, int inNumSamples)
931 if (inNumSamples) {
932 float a = DEMANDINPUT_A(0, inNumSamples);
933 float b = DEMANDINPUT_A(1, inNumSamples);
934 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : (a >= b ? 1.f : 0.f);
935 } else {
936 RESETINPUT(0);
937 RESETINPUT(1);
941 void eq_d(BinaryOpUGen *unit, int inNumSamples)
943 if (inNumSamples) {
944 float a = DEMANDINPUT_A(0, inNumSamples);
945 float b = DEMANDINPUT_A(1, inNumSamples);
946 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : (a == b ? 1.f : 0.f);
947 } else {
948 RESETINPUT(0);
949 RESETINPUT(1);
953 void neq_d(BinaryOpUGen *unit, int inNumSamples)
955 if (inNumSamples) {
956 float a = DEMANDINPUT_A(0, inNumSamples);
957 float b = DEMANDINPUT_A(1, inNumSamples);
958 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : (a != b ? 1.f : 0.f);
959 } else {
960 RESETINPUT(0);
961 RESETINPUT(1);
965 void sumsqr_d(BinaryOpUGen *unit, int inNumSamples)
967 if (inNumSamples) {
968 float a = DEMANDINPUT_A(0, inNumSamples);
969 float b = DEMANDINPUT_A(1, inNumSamples);
970 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : a * a + b * b;
971 } else {
972 RESETINPUT(0);
973 RESETINPUT(1);
977 void difsqr_d(BinaryOpUGen *unit, int inNumSamples)
979 if (inNumSamples) {
980 float a = DEMANDINPUT_A(0, inNumSamples);
981 float b = DEMANDINPUT_A(1, inNumSamples);
982 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : a * a - b * b;
983 } else {
984 RESETINPUT(0);
985 RESETINPUT(1);
989 void sqrsum_d(BinaryOpUGen *unit, int inNumSamples)
991 if (inNumSamples) {
992 float a = DEMANDINPUT_A(0, inNumSamples);
993 float b = DEMANDINPUT_A(1, inNumSamples);
994 float z;
995 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : (z = a + b, z * z);
996 } else {
997 RESETINPUT(0);
998 RESETINPUT(1);
1002 void sqrdif_d(BinaryOpUGen *unit, int inNumSamples)
1004 if (inNumSamples) {
1005 float a = DEMANDINPUT_A(0, inNumSamples);
1006 float b = DEMANDINPUT_A(1, inNumSamples);
1007 float z;
1008 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : (z = a - b, z * z);
1009 } else {
1010 RESETINPUT(0);
1011 RESETINPUT(1);
1015 void absdif_d(BinaryOpUGen *unit, int inNumSamples)
1017 if (inNumSamples) {
1018 float a = DEMANDINPUT_A(0, inNumSamples);
1019 float b = DEMANDINPUT_A(1, inNumSamples);
1020 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : fabs(a - b);
1021 } else {
1022 RESETINPUT(0);
1023 RESETINPUT(1);
1027 void round_d(BinaryOpUGen *unit, int inNumSamples)
1029 if (inNumSamples) {
1030 float a = DEMANDINPUT_A(0, inNumSamples);
1031 float b = DEMANDINPUT_A(1, inNumSamples);
1032 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : sc_round(a, b);
1033 } else {
1034 RESETINPUT(0);
1035 RESETINPUT(1);
1039 void roundUp_d(BinaryOpUGen *unit, int inNumSamples)
1041 if (inNumSamples) {
1042 float a = DEMANDINPUT_A(0, inNumSamples);
1043 float b = DEMANDINPUT_A(1, inNumSamples);
1044 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : sc_roundUp(a, b);
1045 } else {
1046 RESETINPUT(0);
1047 RESETINPUT(1);
1051 void trunc_d(BinaryOpUGen *unit, int inNumSamples)
1053 if (inNumSamples) {
1054 float a = DEMANDINPUT_A(0, inNumSamples);
1055 float b = DEMANDINPUT_A(1, inNumSamples);
1056 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : sc_trunc(a, b);
1057 } else {
1058 RESETINPUT(0);
1059 RESETINPUT(1);
1063 void fold2_d(BinaryOpUGen *unit, int inNumSamples)
1065 if (inNumSamples) {
1066 float a = DEMANDINPUT_A(0, inNumSamples);
1067 float b = DEMANDINPUT_A(1, inNumSamples);
1068 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : sc_fold2(a, b);
1069 } else {
1070 RESETINPUT(0);
1071 RESETINPUT(1);
1075 void wrap2_d(BinaryOpUGen *unit, int inNumSamples)
1077 if (inNumSamples) {
1078 float a = DEMANDINPUT_A(0, inNumSamples);
1079 float b = DEMANDINPUT_A(1, inNumSamples);
1080 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : sc_wrap2(a, b);
1081 } else {
1082 RESETINPUT(0);
1083 RESETINPUT(1);
1087 void atan2_d(BinaryOpUGen *unit, int inNumSamples)
1089 if (inNumSamples) {
1090 float a = DEMANDINPUT_A(0, inNumSamples);
1091 float b = DEMANDINPUT_A(1, inNumSamples);
1092 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : atan2(a, b);
1093 } else {
1094 RESETINPUT(0);
1095 RESETINPUT(1);
1099 void hypot_d(BinaryOpUGen *unit, int inNumSamples)
1101 if (inNumSamples) {
1102 float a = DEMANDINPUT_A(0, inNumSamples);
1103 float b = DEMANDINPUT_A(1, inNumSamples);
1104 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : hypot(a, b);
1105 } else {
1106 RESETINPUT(0);
1107 RESETINPUT(1);
1111 void hypotx_d(BinaryOpUGen *unit, int inNumSamples)
1113 if (inNumSamples) {
1114 float a = DEMANDINPUT_A(0, inNumSamples);
1115 float b = DEMANDINPUT_A(1, inNumSamples);
1116 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : sc_hypotx(a, b);
1117 } else {
1118 RESETINPUT(0);
1119 RESETINPUT(1);
1125 void zero_1(BinaryOpUGen *unit, int inNumSamples)
1127 ZOUT0(0) = 0.f;
1130 void firstarg_1(BinaryOpUGen *unit, int inNumSamples)
1132 ZOUT0(0) = ZIN0(0);
1135 void secondarg_1(BinaryOpUGen *unit, int inNumSamples)
1137 ZOUT0(0) = ZIN0(1);
1140 void add_1(BinaryOpUGen *unit, int inNumSamples)
1142 ZOUT0(0) = ZIN0(0) + ZIN0(1);
1145 void sub_1(BinaryOpUGen *unit, int inNumSamples)
1147 ZOUT0(0) = ZIN0(0) - ZIN0(1);
1150 void mul_1(BinaryOpUGen *unit, int inNumSamples)
1152 ZOUT0(0) = ZIN0(0) * ZIN0(1);
1155 void div_1(BinaryOpUGen *unit, int inNumSamples)
1157 ZOUT0(0) = ZIN0(0) / ZIN0(1);
1160 void mod_1(BinaryOpUGen *unit, int inNumSamples)
1162 float xa = ZIN0(0);
1163 float xb = ZIN0(1);
1164 ZOUT0(0) = sc_mod(xa, xb);
1167 void max_1(BinaryOpUGen *unit, int inNumSamples)
1169 float xa = ZIN0(0);
1170 float xb = ZIN0(1);
1171 ZOUT0(0) = sc_max(xa, xb);
1174 void min_1(BinaryOpUGen *unit, int inNumSamples)
1176 float xa = ZIN0(0);
1177 float xb = ZIN0(1);
1178 ZOUT0(0) = sc_min(xa, xb);
1181 void and_1(BinaryOpUGen *unit, int inNumSamples)
1183 float xa = ZIN0(0);
1184 float xb = ZIN0(1);
1185 ZOUT0(0) = sc_andt(xa, xb);
1188 void or_1(BinaryOpUGen *unit, int inNumSamples)
1190 float xa = ZIN0(0);
1191 float xb = ZIN0(1);
1192 ZOUT0(0) = sc_ort(xa, xb);
1195 void xor_1(BinaryOpUGen *unit, int inNumSamples)
1197 float xa = ZIN0(0);
1198 float xb = ZIN0(1);
1199 ZOUT0(0) = sc_xort(xa, xb);
1202 void rightShift_1(BinaryOpUGen *unit, int inNumSamples)
1204 float xa = ZIN0(0);
1205 float xb = ZIN0(1);
1206 ZOUT0(0) = sc_rst(xa, xb);
1209 void leftShift_1(BinaryOpUGen *unit, int inNumSamples)
1211 float xa = ZIN0(0);
1212 float xb = ZIN0(1);
1213 ZOUT0(0) = sc_lst(xa, xb);
1216 void amclip_1(BinaryOpUGen *unit, int inNumSamples)
1218 float xa = ZIN0(0);
1219 float xb = ZIN0(1);
1220 ZOUT0(0) = sc_amclip(xa, xb);
1223 void scaleneg_1(BinaryOpUGen *unit, int inNumSamples)
1225 float xa = ZIN0(0);
1226 float xb = ZIN0(1);
1227 ZOUT0(0) = xa >= 0.f ? xa : xa * xb;
1230 void pow_1(BinaryOpUGen *unit, int inNumSamples)
1232 float xa = ZIN0(0);
1233 float xb = ZIN0(1);
1234 ZOUT0(0) = xa >= 0.f ? pow(xa, xb) : -pow(-xa, xb);
1238 void ring1_1(BinaryOpUGen *unit, int inNumSamples)
1240 float xa = ZIN0(0);
1241 float xb = ZIN0(1);
1242 ZOUT0(0) = xa * xb + xa;
1245 void ring2_1(BinaryOpUGen *unit, int inNumSamples)
1247 float xa = ZIN0(0);
1248 float xb = ZIN0(1);
1249 ZOUT0(0) = xa * xb + xa + xb;
1252 void ring3_1(BinaryOpUGen *unit, int inNumSamples)
1254 float xa = ZIN0(0);
1255 float xb = ZIN0(1);
1256 ZOUT0(0) = xa * xa * xb;
1259 void ring4_1(BinaryOpUGen *unit, int inNumSamples)
1261 float xa = ZIN0(0);
1262 float xb = ZIN0(1);
1263 ZOUT0(0) = xa * xa * xb - xa * xb * xb;
1266 void thresh_1(BinaryOpUGen *unit, int inNumSamples)
1268 float xa = ZIN0(0);
1269 float xb = ZIN0(1);
1270 ZOUT0(0) = xa < xb ? 0.f : xa;
1273 void clip2_1(BinaryOpUGen *unit, int inNumSamples)
1275 float xa = ZIN0(0);
1276 float xb = ZIN0(1);
1277 ZOUT0(0) = xa > xb ? xb : (xa < -xb ? -xb : xa);
1280 void excess_1(BinaryOpUGen *unit, int inNumSamples)
1282 float xa = ZIN0(0);
1283 float xb = ZIN0(1);
1284 ZOUT0(0) = xa > xb ? xa-xb : (xa < -xb ? xa+xb : 0.f);
1287 void lt_1(BinaryOpUGen *unit, int inNumSamples)
1289 float xa = ZIN0(0);
1290 float xb = ZIN0(1);
1291 ZOUT0(0) = xa < xb ? 1.f : 0.f;
1294 void le_1(BinaryOpUGen *unit, int inNumSamples)
1296 float xa = ZIN0(0);
1297 float xb = ZIN0(1);
1298 ZOUT0(0) = xa <= xb ? 1.f : 0.f;
1301 void gt_1(BinaryOpUGen *unit, int inNumSamples)
1303 float xa = ZIN0(0);
1304 float xb = ZIN0(1);
1305 ZOUT0(0) = xa > xb ? 1.f : 0.f;
1308 void ge_1(BinaryOpUGen *unit, int inNumSamples)
1310 float xa = ZIN0(0);
1311 float xb = ZIN0(1);
1312 ZOUT0(0) = xa >= xb ? 1.f : 0.f;
1315 void eq_1(BinaryOpUGen *unit, int inNumSamples)
1317 float xa = ZIN0(0);
1318 float xb = ZIN0(1);
1319 ZOUT0(0) = xa == xb ? 1.f : 0.f;
1322 void neq_1(BinaryOpUGen *unit, int inNumSamples)
1324 float xa = ZIN0(0);
1325 float xb = ZIN0(1);
1326 ZOUT0(0) = xa != xb ? 1.f : 0.f;
1330 void sumsqr_1(BinaryOpUGen *unit, int inNumSamples)
1332 float xa = ZIN0(0);
1333 float xb = ZIN0(1);
1334 ZOUT0(0) = xa * xa + xb * xb;
1337 void difsqr_1(BinaryOpUGen *unit, int inNumSamples)
1339 float xa = ZIN0(0);
1340 float xb = ZIN0(1);
1341 ZOUT0(0) = xa * xa - xb * xb;
1344 void sqrsum_1(BinaryOpUGen *unit, int inNumSamples)
1346 float xa = ZIN0(0);
1347 float xb = ZIN0(1);
1348 float sum = xa + xb;
1349 ZOUT0(0) = sum * sum;
1352 void sqrdif_1(BinaryOpUGen *unit, int inNumSamples)
1354 float xa = ZIN0(0);
1355 float xb = ZIN0(1);
1356 float dif = xa - xb;
1357 ZOUT0(0) = dif * dif;
1360 void absdif_1(BinaryOpUGen *unit, int inNumSamples)
1362 float xa = ZIN0(0);
1363 float xb = ZIN0(1);
1364 ZOUT0(0) = fabs(xa - xb);
1367 void round_1(BinaryOpUGen *unit, int inNumSamples)
1369 float xa = ZIN0(0);
1370 float xb = ZIN0(1);
1371 ZOUT0(0) = sc_round(xa, xb);
1374 void roundUp_1(BinaryOpUGen *unit, int inNumSamples)
1376 float xa = ZIN0(0);
1377 float xb = ZIN0(1);
1378 ZOUT0(0) = sc_roundUp(xa, xb);
1381 void trunc_1(BinaryOpUGen *unit, int inNumSamples)
1383 float xa = ZIN0(0);
1384 float xb = ZIN0(1);
1385 ZOUT0(0) = sc_trunc(xa, xb);
1388 void fold2_1(BinaryOpUGen *unit, int inNumSamples)
1390 float xa = ZIN0(0);
1391 float xb = ZIN0(1);
1392 ZOUT0(0) = sc_fold(xa, -xb, xb);
1395 void wrap2_1(BinaryOpUGen *unit, int inNumSamples)
1397 float xa = ZIN0(0);
1398 float xb = ZIN0(1);
1399 ZOUT0(0) = sc_wrap(xa, -xb, xb);
1402 void atan2_1(BinaryOpUGen *unit, int inNumSamples)
1404 float xa = ZIN0(0);
1405 float xb = ZIN0(1);
1406 ZOUT0(0) = atan2(xa, xb);
1409 void hypot_1(BinaryOpUGen *unit, int inNumSamples)
1411 float xa = ZIN0(0);
1412 float xb = ZIN0(1);
1413 ZOUT0(0) = hypot(xa, xb);
1416 void hypotx_1(BinaryOpUGen *unit, int inNumSamples)
1418 float xa = ZIN0(0);
1419 float xb = ZIN0(1);
1420 ZOUT0(0) = sc_hypotx(xa, xb);
1425 void zero_aa(BinaryOpUGen *unit, int inNumSamples)
1427 float *out = ZOUT(0);
1429 ZClear(inNumSamples, out);
1432 void firstarg_aa(BinaryOpUGen *unit, int inNumSamples)
1434 float *out = ZOUT(0);
1435 float *a = ZIN(0);
1437 ZCopy(inNumSamples, out, a);
1440 #ifdef NOVA_SIMD
1441 FLATTEN void firstarg_aa_nova(BinaryOpUGen *unit, int inNumSamples)
1443 nova::copyvec_simd(OUT(0), IN(0), inNumSamples);
1445 #endif
1447 void secondarg_aa(BinaryOpUGen *unit, int inNumSamples)
1449 float *out = ZOUT(0);
1450 float *b = ZIN(1);
1452 ZCopy(inNumSamples, out, b);
1455 #ifdef NOVA_SIMD
1456 FLATTEN void secondarg_aa_nova(BinaryOpUGen *unit, int inNumSamples)
1458 nova::copyvec_simd(OUT(0), IN(1), inNumSamples);
1460 #endif
1462 void add_aa(BinaryOpUGen *unit, int inNumSamples)
1464 float *out = ZOUT(0);
1465 float *a = ZIN(0);
1466 float *b = ZIN(1);
1468 LOOP1(inNumSamples,
1469 ZXP(out) = ZXP(a) + ZXP(b);
1473 void add_ak(BinaryOpUGen *unit, int inNumSamples)
1475 float *out = ZOUT(0);
1476 float *a = ZIN(0);
1477 float xb = unit->mPrevB;
1478 float next_b = ZIN0(1);
1480 if (xb == next_b) {
1481 if (xb == 0.f) {
1482 ZCopy(inNumSamples, out, a);
1483 } else {
1484 float *out = ZOUT(0);
1485 float *a = ZIN(0);
1486 LOOP1(inNumSamples,
1487 ZXP(out) = ZXP(a) + xb;
1490 } else {
1491 float slope = CALCSLOPE(next_b, xb);
1492 LOOP1(inNumSamples,
1493 ZXP(out) = ZXP(a) + xb;
1494 xb += slope;
1496 unit->mPrevB = xb;
1501 void add_ka(BinaryOpUGen *unit, int inNumSamples)
1503 float *out = ZOUT(0);
1504 float xa = unit->mPrevA;
1505 float *b = ZIN(1);
1506 float next_a = ZIN0(0);
1508 if (xa == next_a) {
1509 if (xa == 0.f) {
1510 ZCopy(inNumSamples, out, b);
1511 } else {
1512 LOOP1(inNumSamples,
1513 ZXP(out) = xa + ZXP(b);
1516 } else {
1517 float slope = CALCSLOPE(next_a, xa);
1518 LOOP1(inNumSamples,
1519 ZXP(out) = xa + ZXP(b);
1520 xa += slope;
1522 unit->mPrevA = xa;
1526 void add_ia(BinaryOpUGen *unit, int inNumSamples)
1528 float *out = ZOUT(0);
1529 float xa = ZIN0(0);
1530 float *b = ZIN(1);
1532 LOOP1(inNumSamples,
1533 ZXP(out) = xa + ZXP(b);
1535 unit->mPrevA = xa;
1538 void add_ai(BinaryOpUGen *unit, int inNumSamples)
1540 float *out = ZOUT(0);
1541 float *a = ZIN(0);
1542 float xb = ZIN0(1);
1544 LOOP1(inNumSamples,
1545 ZXP(out) = ZXP(a) + xb;
1547 unit->mPrevB = xb;
1550 #ifdef NOVA_SIMD
1551 NOVA_BINARY_WRAPPER(add, plus)
1553 FLATTEN void add_ak_nova(BinaryOpUGen *unit, int inNumSamples)
1555 float xb = unit->mPrevB;
1556 float next_b = ZIN0(1);
1558 if (xb == next_b) {
1559 if (xb == 0.f)
1560 nova::copyvec_simd(OUT(0), IN(0), inNumSamples);
1561 else
1562 nova::plus_vec_simd(OUT(0), IN(0), xb, inNumSamples);
1563 } else {
1564 float slope = CALCSLOPE(next_b, xb);
1565 nova::plus_vec_simd(OUT(0), IN(0), slope_argument(xb, slope), inNumSamples);
1566 unit->mPrevB = next_b;
1570 FLATTEN void add_ak_nova_64(BinaryOpUGen *unit, int inNumSamples)
1572 float xb = unit->mPrevB;
1573 float next_b = ZIN0(1);
1575 if (xb == next_b) {
1576 if (xb == 0.f)
1577 nova::copyvec_simd<64>(OUT(0), IN(0));
1578 else
1579 nova::plus_vec_simd<64>(OUT(0), IN(0), xb);
1580 } else {
1581 float slope = CALCSLOPE(next_b, xb);
1582 nova::plus_vec_simd(OUT(0), IN(0), slope_argument(xb, slope), inNumSamples);
1583 unit->mPrevB = next_b;
1588 FLATTEN void add_ka_nova(BinaryOpUGen *unit, int inNumSamples)
1590 float xa = unit->mPrevA;
1591 float next_a = ZIN0(0);
1593 if (xa == next_a) {
1594 if (xa == 0.f)
1595 nova::copyvec_simd(OUT(0), IN(1), inNumSamples);
1596 else
1597 nova::plus_vec_simd(OUT(0), IN(1), xa, inNumSamples);
1598 } else {
1599 float slope = CALCSLOPE(next_a, xa);
1600 nova::plus_vec_simd(OUT(0), IN(1), slope_argument(xa, slope), inNumSamples);
1601 unit->mPrevA = next_a;
1605 FLATTEN void add_ka_nova_64(BinaryOpUGen *unit, int inNumSamples)
1607 float xa = unit->mPrevA;
1608 float next_a = ZIN0(0);
1610 if (xa == next_a) {
1611 if (xa == 0.f)
1612 nova::copyvec_simd<64>(OUT(0), IN(1));
1613 else
1614 nova::plus_vec_simd<64>(OUT(0), IN(1), xa);
1615 } else {
1616 float slope = CALCSLOPE(next_a, xa);
1617 nova::plus_vec_simd(OUT(0), IN(1), slope_argument(xa, slope), inNumSamples);
1618 unit->mPrevA = next_a;
1622 #endif
1626 /////////////////////////
1630 void sub_aa(BinaryOpUGen *unit, int inNumSamples)
1632 float *out = ZOUT(0);
1633 float *a = ZIN(0);
1634 float *b = ZIN(1);
1636 LOOP1(inNumSamples,
1637 ZXP(out) = ZXP(a) - ZXP(b);
1641 void sub_ak(BinaryOpUGen *unit, int inNumSamples)
1643 float *out = ZOUT(0);
1644 float *a = ZIN(0);
1645 float xb = unit->mPrevB;
1646 float next_b = ZIN0(1);
1648 if (xb == next_b) {
1649 if (xb == 0.f) {
1650 ZCopy(inNumSamples, out, a);
1651 } else {
1652 LOOP1(inNumSamples,
1653 ZXP(out) = ZXP(a) - xb;
1656 } else {
1657 float slope = CALCSLOPE(next_b, xb);
1658 LOOP1(inNumSamples,
1659 ZXP(out) = ZXP(a) - xb;
1660 xb += slope;
1662 unit->mPrevB = xb;
1666 void sub_ka(BinaryOpUGen *unit, int inNumSamples)
1668 float *out = ZOUT(0);
1669 float xa = unit->mPrevA;
1670 float *b = ZIN(1);
1671 float next_a = ZIN0(0);
1673 if (xa == next_a) {
1674 if (xa == 0.f) {
1675 ZCopy(inNumSamples, out, b);
1676 } else {
1677 LOOP1(inNumSamples,
1678 ZXP(out) = xa - ZXP(b);
1681 } else {
1682 float slope = CALCSLOPE(next_a, xa);
1683 LOOP1(inNumSamples,
1684 ZXP(out) = xa - ZXP(b);
1685 xa += slope;
1687 unit->mPrevA = xa;
1692 void sub_ia(BinaryOpUGen *unit, int inNumSamples)
1694 float *out = ZOUT(0);
1695 float xa = ZIN0(0);
1696 float *b = ZIN(1);
1698 LOOP1(inNumSamples,
1699 ZXP(out) = xa - ZXP(b);
1701 unit->mPrevA = xa;
1704 void sub_ai(BinaryOpUGen *unit, int inNumSamples)
1706 float *out = ZOUT(0);
1707 float *a = ZIN(0);
1708 float xb = ZIN0(1);
1710 LOOP1(inNumSamples,
1711 ZXP(out) = ZXP(a) - xb;
1713 unit->mPrevB = xb;
1716 #ifdef NOVA_SIMD
1717 NOVA_BINARY_WRAPPER(sub, minus)
1719 FLATTEN void sub_ak_nova(BinaryOpUGen *unit, int inNumSamples)
1721 float xb = unit->mPrevB;
1722 float next_b = ZIN0(1);
1724 if (xb == next_b) {
1725 if (xb == 0.f)
1726 nova::copyvec_simd(OUT(0), IN(0), inNumSamples);
1727 else
1728 nova::minus_vec_simd(OUT(0), IN(0), xb, inNumSamples);
1729 } else {
1730 float slope = CALCSLOPE(next_b, xb);
1731 nova::minus_vec_simd(OUT(0), IN(0), slope_argument(xb, slope), inNumSamples);
1732 unit->mPrevB = next_b;
1736 FLATTEN void sub_ak_nova_64(BinaryOpUGen *unit, int inNumSamples)
1738 float xb = unit->mPrevB;
1739 float next_b = ZIN0(1);
1741 if (xb == next_b) {
1742 if (xb == 0.f)
1743 nova::copyvec_aa_simd<64>(OUT(0), IN(0));
1744 else
1745 nova::minus_vec_simd<64>(OUT(0), IN(0), xb);
1746 } else {
1747 float slope = CALCSLOPE(next_b, xb);
1748 nova::minus_vec_simd(OUT(0), IN(0), slope_argument(xb, slope), inNumSamples);
1749 unit->mPrevB = next_b;
1753 FLATTEN void sub_ka_nova(BinaryOpUGen *unit, int inNumSamples)
1755 float xa = unit->mPrevA;
1756 float next_a = ZIN0(0);
1758 if (xa == next_a) {
1759 if (xa == 0.f)
1760 nova::copyvec_simd(OUT(0), IN(1), inNumSamples);
1761 else
1762 nova::minus_vec_simd(OUT(0), xa, IN(1), inNumSamples);
1763 } else {
1764 float slope = CALCSLOPE(next_a, xa);
1765 nova::minus_vec_simd(OUT(0), slope_argument(xa, slope), IN(1), inNumSamples);
1766 unit->mPrevA = next_a;
1770 FLATTEN void sub_ka_nova_64(BinaryOpUGen *unit, int inNumSamples)
1772 float xa = unit->mPrevA;
1773 float next_a = ZIN0(0);
1775 if (xa == next_a) {
1776 if (xa == 0.f)
1777 nova::copyvec_simd<64>(OUT(0), IN(1));
1778 else
1779 nova::minus_vec_simd<64>(OUT(0), xa, IN(1));
1780 } else {
1781 float slope = CALCSLOPE(next_a, xa);
1782 nova::minus_vec_simd(OUT(0), slope_argument(xa, slope), IN(1), inNumSamples);
1783 unit->mPrevA = next_a;
1787 #endif
1791 void mul_aa(BinaryOpUGen *unit, int inNumSamples)
1793 float *out = ZOUT(0);
1794 float *a = ZIN(0);
1795 float *b = ZIN(1);
1797 LOOP1(inNumSamples,
1798 ZXP(out) = ZXP(a) * ZXP(b);
1802 void mul_ak(BinaryOpUGen *unit, int inNumSamples)
1804 float *out = ZOUT(0);
1805 float *a = ZIN(0);
1806 float xb = unit->mPrevB;
1807 float next_b = ZIN0(1);
1809 if (xb == next_b) {
1810 if (xb == 0.f) {
1811 ZClear(inNumSamples, out);
1812 } else if (xb == 1.f) {
1813 ZCopy(inNumSamples, out, a);
1814 } else {
1815 LOOP1(inNumSamples,
1816 ZXP(out) = ZXP(a) * xb;
1819 } else {
1820 float slope = CALCSLOPE(next_b, xb);
1821 LOOP1(inNumSamples,
1822 ZXP(out) = ZXP(a) * xb;
1823 xb += slope;
1825 unit->mPrevB = xb;
1829 void mul_ka(BinaryOpUGen *unit, int inNumSamples)
1831 float *out = ZOUT(0);
1832 float xa = unit->mPrevA;
1833 float *b = ZIN(1);
1834 float next_a = ZIN0(0);
1836 if (xa == next_a) {
1837 if (xa == 0.f) {
1838 ZClear(inNumSamples, out);
1839 } else if (xa == 1.f) {
1840 ZCopy(inNumSamples, out, b);
1841 } else {
1842 LOOP1(inNumSamples,
1843 ZXP(out) = xa * ZXP(b);
1846 } else {
1847 float slope = CALCSLOPE(next_a, xa);
1848 LOOP1(inNumSamples,
1849 ZXP(out) = xa * ZXP(b);
1850 xa += slope;
1852 unit->mPrevA = xa;
1857 void mul_ai(BinaryOpUGen *unit, int inNumSamples)
1859 float *out = ZOUT(0);
1860 float *a = ZIN(0);
1861 float xb = ZIN0(1);
1863 LOOP1(inNumSamples,
1864 ZXP(out) = ZXP(a) * xb;
1866 unit->mPrevB = xb;
1869 void mul_ia(BinaryOpUGen *unit, int inNumSamples)
1871 float *out = ZOUT(0);
1872 float xa = ZIN0(0);
1873 float *b = ZIN(1);
1875 LOOP1(inNumSamples,
1876 ZXP(out) = xa * ZXP(b);
1878 unit->mPrevA = xa;
1881 #ifdef NOVA_SIMD
1882 NOVA_BINARY_WRAPPER(mul, times)
1884 FLATTEN void mul_ka_nova(BinaryOpUGen *unit, int inNumSamples)
1886 float xa = unit->mPrevA;
1887 float next_a = ZIN0(0);
1889 if (xa == next_a) {
1890 if (xa == 0.f)
1891 nova::zerovec_simd(OUT(0), inNumSamples);
1892 else if (xa == 1.f)
1893 nova::copyvec_simd(OUT(0), IN(1), inNumSamples);
1894 else
1895 nova::times_vec_simd(OUT(0), IN(1), xa, inNumSamples);
1896 } else {
1897 float slope = CALCSLOPE(next_a, xa);
1898 unit->mPrevA = next_a;
1900 nova::times_vec_simd(OUT(0), IN(1), slope_argument(xa, slope), inNumSamples);
1904 FLATTEN void mul_ka_nova_64(BinaryOpUGen *unit, int inNumSamples)
1906 float xa = unit->mPrevA;
1907 float next_a = ZIN0(0);
1909 if (xa == next_a) {
1910 if (xa == 0.f)
1911 nova::zerovec_simd<64>(OUT(0));
1912 else if (xa == 1.f)
1913 nova::copyvec_simd<64>(OUT(0), IN(1));
1914 else
1915 nova::times_vec_simd<64>(OUT(0), IN(1), xa);
1916 } else {
1917 float slope = CALCSLOPE(next_a, xa);
1918 unit->mPrevA = next_a;
1920 nova::times_vec_simd(OUT(0), IN(1), slope_argument(xa, slope), inNumSamples);
1924 FLATTEN void mul_ak_nova(BinaryOpUGen *unit, int inNumSamples)
1926 float xb = unit->mPrevB;
1927 float next_b = ZIN0(1);
1929 if (xb == next_b) {
1930 if (xb == 0.f)
1931 nova::zerovec_simd(OUT(0), inNumSamples);
1932 else if (xb == 1.f)
1933 nova::copyvec_simd(OUT(0), IN(0), inNumSamples);
1934 else
1935 nova::times_vec_simd(OUT(0), IN(0), xb, inNumSamples);
1936 } else {
1937 float slope = CALCSLOPE(next_b, xb);
1938 unit->mPrevB = next_b;
1940 nova::times_vec_simd(OUT(0), IN(0), slope_argument(xb, slope), inNumSamples);
1944 FLATTEN void mul_ak_nova_64(BinaryOpUGen *unit, int inNumSamples)
1946 float xb = unit->mPrevB;
1947 float next_b = ZIN0(1);
1949 if (xb == next_b) {
1950 if (xb == 0.f)
1951 nova::zerovec_simd<64>(OUT(0));
1952 else if (xb == 1.f)
1953 nova::copyvec_simd<64>(OUT(0), IN(0));
1954 else
1955 nova::times_vec_simd<64>(OUT(0), IN(0), xb);
1956 } else {
1957 float slope = CALCSLOPE(next_b, xb);
1958 unit->mPrevB = next_b;
1960 nova::times_vec_simd(OUT(0), IN(0), slope_argument(xb, slope), inNumSamples);
1964 #endif
1967 void div_aa(BinaryOpUGen *unit, int inNumSamples)
1969 float *out = ZOUT(0);
1970 float *a = ZIN(0);
1971 float *b = ZIN(1);
1973 LOOP1(inNumSamples,
1974 ZXP(out) = ZXP(a) / ZXP(b);
1978 void div_ak(BinaryOpUGen *unit, int inNumSamples)
1980 float *out = ZOUT(0);
1981 float *a = ZIN(0);
1982 float xb = unit->mPrevB;
1983 float next_b = ZIN0(1);
1985 if (xb == next_b) {
1986 if (xb == 0.f) {
1987 ZClear(inNumSamples, out);
1988 } else if (xb == 1.f) {
1989 ZCopy(inNumSamples, out, a);
1990 } else {
1991 float recip = 1.f / xb;
1992 LOOP1(inNumSamples,
1993 ZXP(out) = ZXP(a) * recip;
1996 } else {
1997 float slope = CALCSLOPE(next_b, xb);
1998 LOOP1(inNumSamples,
1999 ZXP(out) = ZXP(a) / xb;
2000 xb += slope;
2002 unit->mPrevB = xb;
2006 void div_ka(BinaryOpUGen *unit, int inNumSamples)
2008 float *out = ZOUT(0);
2009 float xa = unit->mPrevA;
2010 float *b = ZIN(1);
2011 float next_a = ZIN0(0);
2013 if (xa == next_a) {
2014 if (xa == 0.f) {
2015 ZClear(inNumSamples, out);
2016 } else {
2017 LOOP1(inNumSamples,
2018 ZXP(out) = xa / ZXP(b);
2021 } else {
2022 float slope = CALCSLOPE(next_a, xa);
2023 LOOP1(inNumSamples,
2024 ZXP(out) = xa / ZXP(b);
2025 xa += slope;
2027 unit->mPrevA = xa;
2031 void div_ia(BinaryOpUGen *unit, int inNumSamples)
2033 float *out = ZOUT(0);
2034 float xa = ZIN0(0);
2035 float *b = ZIN(1);
2037 LOOP1(inNumSamples,
2038 ZXP(out) = xa / ZXP(b);
2040 unit->mPrevA = xa;
2044 void div_ai(BinaryOpUGen *unit, int inNumSamples)
2046 float *out = ZOUT(0);
2047 float *a = ZIN(0);
2048 float xb = ZIN0(1);
2050 float rxb = 1.f / xb;
2051 LOOP1(inNumSamples,
2052 ZXP(out) = ZXP(a) * rxb;
2054 unit->mPrevB = xb;
2057 #ifdef NOVA_SIMD
2058 FLATTEN void div_aa_nova(BinaryOpUGen *unit, int inNumSamples)
2060 nova::over_vec_simd(OUT(0), IN(0), IN(1), inNumSamples);
2063 FLATTEN void div_ia_nova(BinaryOpUGen *unit, int inNumSamples)
2065 float xa = ZIN0(0);
2067 nova::over_vec_simd(OUT(0), xa, IN(1), inNumSamples);
2068 unit->mPrevA = xa;
2071 FLATTEN void div_ai_nova(BinaryOpUGen *unit, int inNumSamples)
2073 float xb = ZIN0(1);
2075 nova::times_vec_simd(OUT(0), IN(0), 1.f/xb, inNumSamples);
2076 unit->mPrevB = xb;
2079 FLATTEN void div_ak_nova(BinaryOpUGen *unit, int inNumSamples)
2081 float xb = unit->mPrevB;
2082 float next_b = ZIN0(1);
2084 if (xb == next_b) {
2085 if (xb == 0.f)
2086 nova::zerovec_simd(OUT(0), inNumSamples);
2087 else if (xb == 1.f)
2088 nova::copyvec_simd(OUT(0), IN(0), inNumSamples);
2089 else {
2090 float recip = 1.f / xb;
2091 nova::times_vec_simd(OUT(0), IN(0), recip, inNumSamples);
2093 } else {
2094 float slope = CALCSLOPE(next_b, xb);
2095 nova::over_vec_simd(OUT(0), IN(0), slope_argument(xb, slope), inNumSamples);
2096 unit->mPrevB = next_b;
2100 FLATTEN void div_ka_nova(BinaryOpUGen *unit, int inNumSamples)
2102 float xa = unit->mPrevA;
2103 float next_a = ZIN0(0);
2105 if (xa == next_a) {
2106 if (xa == 0.f)
2107 nova::zerovec_simd(OUT(0), inNumSamples);
2108 else
2109 nova::over_vec_simd(OUT(0), xa, IN(1), inNumSamples);
2110 } else {
2111 float slope = CALCSLOPE(next_a, xa);
2112 nova::over_vec_simd(OUT(0), slope_argument(xa, slope), IN(1), inNumSamples);
2113 unit->mPrevA = xa;
2117 #endif
2123 void mod_aa(BinaryOpUGen *unit, int inNumSamples)
2125 float *out = ZOUT(0);
2126 float *a = ZIN(0);
2127 float *b = ZIN(1);
2129 LOOP1(inNumSamples,
2130 float xa = ZXP(a);
2131 float xb = ZXP(b);
2132 ZXP(out) = sc_mod(xa, xb);
2136 void mod_ak(BinaryOpUGen *unit, int inNumSamples)
2138 float *out = ZOUT(0);
2139 float *a = ZIN(0);
2140 float xb = unit->mPrevB;
2141 float next_b = ZIN0(1);
2143 if (xb == next_b) {
2144 if (xb == 0.f) {
2145 ZCopy(inNumSamples, out, a);
2146 } else {
2147 LOOP1(inNumSamples,
2148 ZXP(out) = sc_mod(ZXP(a), xb);
2151 } else {
2152 float slope = CALCSLOPE(next_b, xb);
2153 LOOP1(inNumSamples,
2154 ZXP(out) = sc_mod(ZXP(a), xb);
2155 xb += slope;
2157 unit->mPrevB = xb;
2161 void mod_ka(BinaryOpUGen *unit, int inNumSamples)
2163 float *out = ZOUT(0);
2164 float xa = unit->mPrevA;
2165 float *b = ZIN(1);
2166 float next_a = ZIN0(0);
2168 if (xa == next_a) {
2169 if (xa == 0.f) {
2170 ZClear(inNumSamples, out);
2171 } else {
2172 LOOP1(inNumSamples,
2173 ZXP(out) = sc_mod(xa, ZXP(b));
2176 } else {
2177 float slope = CALCSLOPE(next_a, xa);
2178 LOOP1(inNumSamples,
2179 ZXP(out) = sc_mod(xa, ZXP(b));
2180 xa += slope;
2182 unit->mPrevA = xa;
2187 void mod_ia(BinaryOpUGen *unit, int inNumSamples)
2189 float *out = ZOUT(0);
2190 float xa = ZIN0(0);
2191 float *b = ZIN(1);
2193 LOOP1(inNumSamples,
2194 ZXP(out) = sc_mod(xa, ZXP(b));
2196 unit->mPrevA = xa;
2200 void mod_ai(BinaryOpUGen *unit, int inNumSamples)
2202 float *out = ZOUT(0);
2203 float *a = ZIN(0);
2204 float xb = ZIN0(1);
2206 LOOP1(inNumSamples,
2207 ZXP(out) = sc_mod(ZXP(a), xb);
2209 unit->mPrevB = xb;
2214 void max_aa(BinaryOpUGen *unit, int inNumSamples)
2216 float *out = ZOUT(0);
2217 float *a = ZIN(0);
2218 float *b = ZIN(1);
2220 LOOP1(inNumSamples,
2221 float xa = ZXP(a);
2222 float xb = ZXP(b);
2223 ZXP(out) = sc_max(xa, xb);
2227 void max_ak(BinaryOpUGen *unit, int inNumSamples)
2229 float *out = ZOUT(0);
2230 float *a = ZIN(0);
2231 float xb = unit->mPrevB;
2232 float next_b = ZIN0(1);
2234 if (xb == next_b) {
2235 LOOP1(inNumSamples,
2236 float xa = ZXP(a);
2237 ZXP(out) = sc_max(xa, xb);
2239 } else {
2240 float slope = CALCSLOPE(next_b, xb);
2241 LOOP1(inNumSamples,
2242 float xa = ZXP(a);
2243 ZXP(out) = sc_max(xa, xb);
2244 xb += slope;
2246 unit->mPrevB = xb;
2250 void max_ka(BinaryOpUGen *unit, int inNumSamples)
2252 float *out = ZOUT(0);
2253 float xa = unit->mPrevA;
2254 float *b = ZIN(1);
2255 float next_a = ZIN0(0);
2257 if (xa == next_a) {
2258 LOOP1(inNumSamples,
2259 float xb = ZXP(b);
2260 ZXP(out) = sc_max(xa, xb);
2262 } else {
2263 float slope = CALCSLOPE(next_a, xa);
2264 LOOP1(inNumSamples,
2265 float xb = ZXP(b);
2266 ZXP(out) = sc_max(xa, xb);
2267 xa += slope;
2269 unit->mPrevA = xa;
2273 void max_ia(BinaryOpUGen *unit, int inNumSamples)
2275 float *out = ZOUT(0);
2276 float xa = ZIN0(0);
2277 float *b = ZIN(1);
2279 LOOP1(inNumSamples,
2280 float xb = ZXP(b);
2281 ZXP(out) = sc_max(xa, xb);
2283 unit->mPrevA = xa;
2287 void max_ai(BinaryOpUGen *unit, int inNumSamples)
2289 float *out = ZOUT(0);
2290 float *a = ZIN(0);
2291 float xb = ZIN0(1);
2293 LOOP1(inNumSamples,
2294 float xa = ZXP(a);
2295 ZXP(out) = sc_max(xa, xb);
2297 unit->mPrevB = xb;
2300 #ifdef NOVA_SIMD
2301 NOVA_BINARY_WRAPPER_K(max, max)
2302 #endif
2307 void min_aa(BinaryOpUGen *unit, int inNumSamples)
2309 float *out = ZOUT(0);
2310 float *a = ZIN(0);
2311 float *b = ZIN(1);
2313 LOOP1(inNumSamples,
2314 float xa = ZXP(a);
2315 float xb = ZXP(b);
2316 ZXP(out) = sc_min(xa, xb);
2320 void min_ak(BinaryOpUGen *unit, int inNumSamples)
2322 float *out = ZOUT(0);
2323 float *a = ZIN(0);
2324 float xb = unit->mPrevB;
2325 float next_b = ZIN0(1);
2327 if (xb == next_b) {
2328 LOOP1(inNumSamples,
2329 float xa = ZXP(a);
2330 ZXP(out) = sc_min(xa, xb);
2332 } else {
2333 float slope = CALCSLOPE(next_b, xb);
2334 LOOP1(inNumSamples,
2335 float xa = ZXP(a);
2336 ZXP(out) = sc_min(xa, xb);
2337 xb += slope;
2339 unit->mPrevB = xb;
2343 void min_ka(BinaryOpUGen *unit, int inNumSamples)
2345 float *out = ZOUT(0);
2346 float xa = unit->mPrevA;
2347 float *b = ZIN(1);
2348 float next_a = ZIN0(0);
2350 if (xa == next_a) {
2351 LOOP1(inNumSamples,
2352 float xb = ZXP(b);
2353 ZXP(out) = sc_min(xa, xb);
2355 } else {
2356 float slope = CALCSLOPE(next_a, xa);
2357 LOOP1(inNumSamples,
2358 float xb = ZXP(b);
2359 ZXP(out) = sc_min(xa, xb);
2360 xa += slope;
2362 unit->mPrevA = xa;
2366 void min_ia(BinaryOpUGen *unit, int inNumSamples)
2368 float *out = ZOUT(0);
2369 float xa = ZIN0(0);
2370 float *b = ZIN(1);
2372 LOOP1(inNumSamples,
2373 float xb = ZXP(b);
2374 ZXP(out) = sc_min(xa, xb);
2376 unit->mPrevA = xa;
2380 void min_ai(BinaryOpUGen *unit, int inNumSamples)
2382 float *out = ZOUT(0);
2383 float *a = ZIN(0);
2384 float xb = ZIN0(1);
2386 LOOP1(inNumSamples,
2387 float xa = ZXP(a);
2388 ZXP(out) = sc_min(xa, xb);
2390 unit->mPrevB = xb;
2394 #ifdef NOVA_SIMD
2395 NOVA_BINARY_WRAPPER_K(min, min)
2396 #endif
2399 void and_aa(BinaryOpUGen *unit, int inNumSamples)
2401 float *out = ZOUT(0);
2402 float *a = ZIN(0);
2403 float *b = ZIN(1);
2405 LOOP1(inNumSamples,
2406 float xa = ZXP(a);
2407 float xb = ZXP(b);
2408 ZXP(out) = sc_andt(xa, xb) ;
2412 void and_ak(BinaryOpUGen *unit, int inNumSamples)
2414 float *out = ZOUT(0);
2415 float *a = ZIN(0);
2416 float xb = unit->mPrevB;
2417 float next_b = ZIN0(1);
2419 if (xb == next_b) {
2420 LOOP1(inNumSamples,
2421 float xa = ZXP(a);
2422 ZXP(out) = sc_andt(xa, xb);
2424 } else {
2425 float slope = CALCSLOPE(next_b, xb);
2426 LOOP1(inNumSamples,
2427 float xa = ZXP(a);
2428 ZXP(out) = sc_andt(xa, xb);
2429 xb += slope;
2431 unit->mPrevB = xb;
2435 void and_ka(BinaryOpUGen *unit, int inNumSamples)
2437 float *out = ZOUT(0);
2438 float xa = unit->mPrevA;
2439 float *b = ZIN(1);
2440 float next_a = ZIN0(0);
2442 if (xa == next_a) {
2443 LOOP1(inNumSamples,
2444 float xb = ZXP(b);
2445 ZXP(out) = sc_andt(xa, xb);
2447 } else {
2448 float slope = CALCSLOPE(next_a, xa);
2449 LOOP1(inNumSamples,
2450 float xb = ZXP(b);
2451 ZXP(out) = sc_andt(xa, xb);
2452 xa += slope;
2454 unit->mPrevA = xa;
2458 void and_ia(BinaryOpUGen *unit, int inNumSamples)
2460 float *out = ZOUT(0);
2461 float xa = ZIN0(0);
2462 float *b = ZIN(1);
2464 LOOP1(inNumSamples,
2465 float xb = ZXP(b);
2466 ZXP(out) = sc_andt(xa, xb);
2468 unit->mPrevA = xa;
2472 void and_ai(BinaryOpUGen *unit, int inNumSamples)
2474 float *out = ZOUT(0);
2475 float *a = ZIN(0);
2476 float xb = ZIN0(1);
2478 LOOP1(inNumSamples,
2479 float xa = ZXP(a);
2480 ZXP(out) = sc_andt(xa, xb);
2482 unit->mPrevB = xb;
2491 void or_aa(BinaryOpUGen *unit, int inNumSamples)
2493 float *out = ZOUT(0);
2494 float *a = ZIN(0);
2495 float *b = ZIN(1);
2497 LOOP1(inNumSamples,
2498 float xa = ZXP(a);
2499 float xb = ZXP(b);
2500 ZXP(out) = sc_ort(xa, xb) ;
2504 void or_ak(BinaryOpUGen *unit, int inNumSamples)
2506 float *out = ZOUT(0);
2507 float *a = ZIN(0);
2508 float xb = unit->mPrevB;
2509 float next_b = ZIN0(1);
2511 if (xb == next_b) {
2512 LOOP1(inNumSamples,
2513 float xa = ZXP(a);
2514 ZXP(out) = sc_ort(xa, xb);
2516 } else {
2517 float slope = CALCSLOPE(next_b, xb);
2518 LOOP1(inNumSamples,
2519 float xa = ZXP(a);
2520 ZXP(out) = sc_ort(xa, xb);
2521 xb += slope;
2523 unit->mPrevB = xb;
2527 void or_ka(BinaryOpUGen *unit, int inNumSamples)
2529 float *out = ZOUT(0);
2530 float xa = unit->mPrevA;
2531 float *b = ZIN(1);
2532 float next_a = ZIN0(0);
2534 if (xa == next_a) {
2535 LOOP1(inNumSamples,
2536 float xb = ZXP(b);
2537 ZXP(out) = sc_ort(xa, xb);
2539 } else {
2540 float slope = CALCSLOPE(next_a, xa);
2541 LOOP1(inNumSamples,
2542 float xb = ZXP(b);
2543 ZXP(out) = sc_ort(xa, xb);
2544 xa += slope;
2546 unit->mPrevA = xa;
2550 void or_ia(BinaryOpUGen *unit, int inNumSamples)
2552 float *out = ZOUT(0);
2553 float xa = ZIN0(0);
2554 float *b = ZIN(1);
2556 LOOP1(inNumSamples,
2557 float xb = ZXP(b);
2558 ZXP(out) = sc_ort(xa, xb);
2560 unit->mPrevA = xa;
2564 void or_ai(BinaryOpUGen *unit, int inNumSamples)
2566 float *out = ZOUT(0);
2567 float *a = ZIN(0);
2568 float xb = ZIN0(1);
2570 LOOP1(inNumSamples,
2571 float xa = ZXP(a);
2572 ZXP(out) = sc_ort(xa, xb);
2574 unit->mPrevB = xb;
2583 void xor_aa(BinaryOpUGen *unit, int inNumSamples)
2585 float *out = ZOUT(0);
2586 float *a = ZIN(0);
2587 float *b = ZIN(1);
2589 LOOP1(inNumSamples,
2590 float xa = ZXP(a);
2591 float xb = ZXP(b);
2592 ZXP(out) = sc_xort(xa, xb) ;
2596 void xor_ak(BinaryOpUGen *unit, int inNumSamples)
2598 float *out = ZOUT(0);
2599 float *a = ZIN(0);
2600 float xb = unit->mPrevB;
2601 float next_b = ZIN0(1);
2603 if (xb == next_b) {
2604 LOOP1(inNumSamples,
2605 float xa = ZXP(a);
2606 ZXP(out) = sc_xort(xa, xb);
2608 } else {
2609 float slope = CALCSLOPE(next_b, xb);
2610 LOOP1(inNumSamples,
2611 float xa = ZXP(a);
2612 ZXP(out) = sc_xort(xa, xb);
2613 xb += slope;
2615 unit->mPrevB = xb;
2619 void xor_ka(BinaryOpUGen *unit, int inNumSamples)
2621 float *out = ZOUT(0);
2622 float xa = unit->mPrevA;
2623 float *b = ZIN(1);
2624 float next_a = ZIN0(0);
2626 if (xa == next_a) {
2627 LOOP1(inNumSamples,
2628 float xb = ZXP(b);
2629 ZXP(out) = sc_xort(xa, xb);
2631 } else {
2632 float slope = CALCSLOPE(next_a, xa);
2633 LOOP1(inNumSamples,
2634 float xb = ZXP(b);
2635 ZXP(out) = sc_xort(xa, xb);
2636 xa += slope;
2638 unit->mPrevA = xa;
2642 void xor_ia(BinaryOpUGen *unit, int inNumSamples)
2644 float *out = ZOUT(0);
2645 float xa = ZIN0(0);
2646 float *b = ZIN(1);
2648 LOOP1(inNumSamples,
2649 float xb = ZXP(b);
2650 ZXP(out) = sc_xort(xa, xb);
2652 unit->mPrevA = xa;
2656 void xor_ai(BinaryOpUGen *unit, int inNumSamples)
2658 float *out = ZOUT(0);
2659 float *a = ZIN(0);
2660 float xb = ZIN0(1);
2662 LOOP1(inNumSamples,
2663 float xa = ZXP(a);
2664 ZXP(out) = sc_xort(xa, xb);
2666 unit->mPrevB = xb;
2672 void rightShift_aa(BinaryOpUGen *unit, int inNumSamples)
2674 float *out = ZOUT(0);
2675 float *a = ZIN(0);
2676 float *b = ZIN(1);
2678 LOOP1(inNumSamples,
2679 float xa = ZXP(a);
2680 float xb = ZXP(b);
2681 ZXP(out) = sc_rst(xa, xb) ;
2685 void rightShift_ak(BinaryOpUGen *unit, int inNumSamples)
2687 float *out = ZOUT(0);
2688 float *a = ZIN(0);
2689 float xb = unit->mPrevB;
2690 float next_b = ZIN0(1);
2692 if (xb == next_b) {
2693 LOOP1(inNumSamples,
2694 float xa = ZXP(a);
2695 ZXP(out) = sc_rst(xa, xb);
2697 } else {
2698 float slope = CALCSLOPE(next_b, xb);
2699 LOOP1(inNumSamples,
2700 float xa = ZXP(a);
2701 ZXP(out) = sc_rst(xa, xb);
2702 xb += slope;
2704 unit->mPrevB = xb;
2708 void rightShift_ka(BinaryOpUGen *unit, int inNumSamples)
2710 float *out = ZOUT(0);
2711 float xa = unit->mPrevA;
2712 float *b = ZIN(1);
2713 float next_a = ZIN0(0);
2715 if (xa == next_a) {
2716 LOOP1(inNumSamples,
2717 float xb = ZXP(b);
2718 ZXP(out) = sc_rst(xa, xb);
2720 } else {
2721 float slope = CALCSLOPE(next_a, xa);
2722 LOOP1(inNumSamples,
2723 float xb = ZXP(b);
2724 ZXP(out) = sc_rst(xa, xb);
2725 xa += slope;
2727 unit->mPrevA = xa;
2731 void rightShift_ia(BinaryOpUGen *unit, int inNumSamples)
2733 float *out = ZOUT(0);
2734 float xa = ZIN0(0);
2735 float *b = ZIN(1);
2737 LOOP1(inNumSamples,
2738 float xb = ZXP(b);
2739 ZXP(out) = sc_rst(xa, xb);
2741 unit->mPrevA = xa;
2745 void rightShift_ai(BinaryOpUGen *unit, int inNumSamples)
2747 float *out = ZOUT(0);
2748 float *a = ZIN(0);
2749 float xb = ZIN0(1);
2751 LOOP1(inNumSamples,
2752 float xa = ZXP(a);
2753 ZXP(out) = sc_rst(xa, xb);
2755 unit->mPrevB = xb;
2760 void leftShift_aa(BinaryOpUGen *unit, int inNumSamples)
2762 float *out = ZOUT(0);
2763 float *a = ZIN(0);
2764 float *b = ZIN(1);
2766 LOOP1(inNumSamples,
2767 float xa = ZXP(a);
2768 float xb = ZXP(b);
2769 ZXP(out) = sc_lst(xa, xb) ;
2773 void leftShift_ak(BinaryOpUGen *unit, int inNumSamples)
2775 float *out = ZOUT(0);
2776 float *a = ZIN(0);
2777 float xb = unit->mPrevB;
2778 float next_b = ZIN0(1);
2780 if (xb == next_b) {
2781 LOOP1(inNumSamples,
2782 float xa = ZXP(a);
2783 ZXP(out) = sc_lst(xa, xb);
2785 } else {
2786 float slope = CALCSLOPE(next_b, xb);
2787 LOOP1(inNumSamples,
2788 float xa = ZXP(a);
2789 ZXP(out) = sc_lst(xa, xb);
2790 xb += slope;
2792 unit->mPrevB = xb;
2796 void leftShift_ka(BinaryOpUGen *unit, int inNumSamples)
2798 float *out = ZOUT(0);
2799 float xa = unit->mPrevA;
2800 float *b = ZIN(1);
2801 float next_a = ZIN0(0);
2803 if (xa == next_a) {
2804 LOOP1(inNumSamples,
2805 float xb = ZXP(b);
2806 ZXP(out) = sc_lst(xa, xb);
2808 } else {
2809 float slope = CALCSLOPE(next_a, xa);
2810 LOOP1(inNumSamples,
2811 float xb = ZXP(b);
2812 ZXP(out) = sc_lst(xa, xb);
2813 xa += slope;
2815 unit->mPrevA = xa;
2819 void leftShift_ia(BinaryOpUGen *unit, int inNumSamples)
2821 float *out = ZOUT(0);
2822 float xa = ZIN0(0);
2823 float *b = ZIN(1);
2825 LOOP1(inNumSamples,
2826 float xb = ZXP(b);
2827 ZXP(out) = sc_lst(xa, xb);
2829 unit->mPrevA = xa;
2833 void leftShift_ai(BinaryOpUGen *unit, int inNumSamples)
2835 float *out = ZOUT(0);
2836 float *a = ZIN(0);
2837 float xb = ZIN0(1);
2839 LOOP1(inNumSamples,
2840 float xa = ZXP(a);
2841 ZXP(out) = sc_lst(xa, xb);
2843 unit->mPrevB = xb;
2850 void amclip_aa(BinaryOpUGen *unit, int inNumSamples)
2852 float *out = ZOUT(0);
2853 float *a = ZIN(0);
2854 float *b = ZIN(1);
2856 LOOP1(inNumSamples,
2857 float xa = ZXP(a);
2858 float xb = ZXP(b);
2859 ZXP(out) = sc_amclip(xa, xb);
2863 void amclip_ak(BinaryOpUGen *unit, int inNumSamples)
2865 float *out = ZOUT(0);
2866 float *a = ZIN(0);
2867 float xb = unit->mPrevB;
2868 float next_b = ZIN0(1);
2870 if (xb == next_b) {
2871 if (xb > 0.f) {
2872 LOOP1(inNumSamples,
2873 ZXP(out) = ZXP(a) * xb;
2875 } else {
2876 ZClear(inNumSamples, out);
2878 } else {
2879 float slope = CALCSLOPE(next_b, xb);
2880 LOOP1(inNumSamples,
2881 float xa = ZXP(a);
2882 ZXP(out) = sc_amclip(xa, xb);
2883 xb += slope;
2885 unit->mPrevB = xb;
2889 void amclip_ka(BinaryOpUGen *unit, int inNumSamples)
2891 float *out = ZOUT(0);
2892 float xa = unit->mPrevA;
2893 float *b = ZIN(1);
2894 float next_a = ZIN0(0);
2896 if (xa == next_a) {
2897 LOOP1(inNumSamples,
2898 float xb = ZXP(b);
2899 ZXP(out) = sc_amclip(xa, xb);
2901 } else {
2902 float slope = CALCSLOPE(next_a, xa);
2903 LOOP1(inNumSamples,
2904 float xb = ZXP(b);
2905 ZXP(out) = sc_amclip(xa, xb);
2906 xa += slope;
2908 unit->mPrevA = xa;
2912 void amclip_ia(BinaryOpUGen *unit, int inNumSamples)
2914 float *out = ZOUT(0);
2915 float xa = ZIN0(0);
2916 float *b = ZIN(1);
2918 LOOP1(inNumSamples,
2919 float xb = ZXP(b);
2920 ZXP(out) = sc_amclip(xa, xb);
2922 unit->mPrevA = xa;
2926 void amclip_ai(BinaryOpUGen *unit, int inNumSamples)
2928 float *out = ZOUT(0);
2929 float *a = ZIN(0);
2930 float xb = ZIN0(1);
2932 LOOP1(inNumSamples,
2933 float xa = ZXP(a);
2934 ZXP(out) = sc_amclip(xa, xb);
2936 unit->mPrevB = xb;
2941 void scaleneg_aa(BinaryOpUGen *unit, int inNumSamples)
2943 float *out = ZOUT(0);
2944 float *a = ZIN(0);
2945 float *b = ZIN(1);
2947 LOOP1(inNumSamples,
2948 float xa = ZXP(a);
2949 float xb = ZXP(b);
2950 ZXP(out) = xa >= 0.f ? xa : xa * xb;
2954 void scaleneg_ak(BinaryOpUGen *unit, int inNumSamples)
2956 float *out = ZOUT(0);
2957 float *a = ZIN(0);
2958 float xb = unit->mPrevB;
2959 float next_b = ZIN0(1);
2961 if (xb == next_b) {
2962 LOOP1(inNumSamples,
2963 float xa = ZXP(a);
2964 ZXP(out) = xa >= 0.f ? xa : xa * xb;
2966 } else {
2967 float slope = CALCSLOPE(next_b, xb);
2968 LOOP1(inNumSamples,
2969 float xa = ZXP(a);
2970 ZXP(out) = xa >= 0.f ? xa : xa * xb;
2971 xb += slope;
2973 unit->mPrevB = xb;
2977 void scaleneg_ka(BinaryOpUGen *unit, int inNumSamples)
2979 float *out = ZOUT(0);
2980 float xa = unit->mPrevA;
2981 float *b = ZIN(1);
2982 float next_a = ZIN0(0);
2984 if (xa == next_a) {
2985 if (xa >= 0.f) {
2986 LOOP1(inNumSamples,
2987 ZXP(out) = xa;
2989 } else {
2990 LOOP1(inNumSamples,
2991 ZXP(out) = xa * ZXP(b);
2994 } else {
2995 float slope = CALCSLOPE(next_a, xa);
2996 LOOP1(inNumSamples,
2997 float xb = ZXP(b);
2998 ZXP(out) = xa >= 0.f ? xa : xa * xb;
2999 xa += slope;
3001 unit->mPrevA = xa;
3005 void scaleneg_ia(BinaryOpUGen *unit, int inNumSamples)
3007 float *out = ZOUT(0);
3008 float xa = ZIN0(0);
3009 float *b = ZIN(1);
3011 LOOP1(inNumSamples,
3012 float xb = ZXP(b);
3013 ZXP(out) = xa >= 0.f ? xa : xa * xb;
3015 unit->mPrevA = xa;
3019 void scaleneg_ai(BinaryOpUGen *unit, int inNumSamples)
3021 float *out = ZOUT(0);
3022 float *a = ZIN(0);
3023 float xb = ZIN0(1);
3025 LOOP1(inNumSamples,
3026 float xa = ZXP(a);
3027 ZXP(out) = xa >= 0.f ? xa : xa * xb;
3029 unit->mPrevB = xb;
3035 void pow_aa(BinaryOpUGen *unit, int inNumSamples)
3037 float *out = ZOUT(0);
3038 float *a = ZIN(0);
3039 float *b = ZIN(1);
3041 LOOP1(inNumSamples,
3042 float xa = ZXP(a);
3043 float xb = ZXP(b);
3044 ZXP(out) = xa >= 0.f ? pow(xa, xb) : -pow(-xa, xb);
3049 void pow_ak(BinaryOpUGen *unit, int inNumSamples)
3051 float *out = ZOUT(0);
3052 float *a = ZIN(0);
3053 float xb = unit->mPrevB;
3054 float next_b = ZIN0(1);
3056 if (xb == next_b) {
3057 LOOP1(inNumSamples,
3058 float xa = ZXP(a);
3059 ZXP(out) = xa >= 0.f ? pow(xa, xb) : -pow(-xa, xb);
3061 } else {
3062 float slope = CALCSLOPE(next_b, xb);
3063 LOOP1(inNumSamples,
3064 float xa = ZXP(a);
3065 ZXP(out) = xa >= 0.f ? pow(xa, xb) : -pow(-xa, xb);
3066 xb += slope;
3068 unit->mPrevB = xb;
3072 void pow_ka(BinaryOpUGen *unit, int inNumSamples)
3074 float *out = ZOUT(0);
3075 float xa = unit->mPrevA;
3076 float *b = ZIN(1);
3077 float next_a = ZIN0(0);
3079 if (xa == next_a) {
3080 if (xa >= 0.f) {
3081 LOOP1(inNumSamples,
3082 float xb = ZXP(b);
3083 ZXP(out) = pow(xa, xb);
3085 } else {
3086 LOOP1(inNumSamples,
3087 float xb = ZXP(b);
3088 ZXP(out) = -pow(-xa, xb);
3091 } else {
3092 float slope = CALCSLOPE(next_a, xa);
3093 LOOP1(inNumSamples,
3094 float xb = ZXP(b);
3095 ZXP(out) = xa >= 0.f ? pow(xa, xb) : -pow(-xa, xb);
3096 xa += slope;
3098 unit->mPrevA = xa;
3102 void pow_ia(BinaryOpUGen *unit, int inNumSamples)
3104 float *out = ZOUT(0);
3105 float xa = ZIN0(0);
3106 float *b = ZIN(1);
3108 LOOP1(inNumSamples,
3109 float xb = ZXP(b);
3110 ZXP(out) = xa >= 0.f ? pow(xa, xb) : -pow(-xa, xb);
3112 unit->mPrevA = xa;
3116 void pow_ai(BinaryOpUGen *unit, int inNumSamples)
3118 float *out = ZOUT(0);
3119 float *a = ZIN(0);
3120 float xb = ZIN0(1);
3122 LOOP1(inNumSamples,
3123 float xa = ZXP(a);
3124 ZXP(out) = xa >= 0.f ? pow(xa, xb) : -pow(-xa, xb);
3126 unit->mPrevB = xb;
3129 #ifdef NOVA_SIMD
3130 FLATTEN void pow_aa_nova(BinaryOpUGen *unit, int inNumSamples)
3132 nova::spow_vec_simd(OUT(0), IN(0), IN(1), inNumSamples);
3135 FLATTEN void pow_ak_nova(BinaryOpUGen *unit, int inNumSamples)
3137 float *out = ZOUT(0);
3138 float *a = ZIN(0);
3139 float xb = unit->mPrevB;
3140 float next_b = ZIN0(1);
3142 if (xb == next_b) {
3143 nova::spow_vec_simd(OUT(0), IN(0), xb, inNumSamples);
3144 } else {
3145 float slope = CALCSLOPE(next_b, xb);
3146 LOOP1(inNumSamples,
3147 float xa = ZXP(a);
3148 ZXP(out) = xa >= 0.f ? pow(xa, xb) : -pow(-xa, xb);
3149 xb += slope;
3151 unit->mPrevB = xb;
3155 FLATTEN void pow_ka_nova(BinaryOpUGen *unit, int inNumSamples)
3157 float *out = ZOUT(0);
3158 float xa = unit->mPrevA;
3159 float *b = ZIN(1);
3160 float next_a = ZIN0(0);
3162 if (xa == next_a) {
3163 if (xa >= 0.f) {
3164 nova::pow_vec_simd(OUT(0), xa, IN(1), inNumSamples);
3165 } else {
3166 nova::spow_vec_simd(OUT(0), xa, IN(1), inNumSamples);
3168 } else {
3169 float slope = CALCSLOPE(next_a, xa);
3170 LOOP1(inNumSamples,
3171 float xb = ZXP(b);
3172 ZXP(out) = xa >= 0.f ? pow(xa, xb) : -pow(-xa, xb);
3173 xa += slope;
3175 unit->mPrevA = xa;
3180 FLATTEN void pow_ia_nova(BinaryOpUGen *unit, int inNumSamples)
3182 float xa = ZIN0(0);
3183 if (xa > 0.f)
3184 nova::pow_vec_simd(OUT(0), xa, IN(1), inNumSamples);
3185 else
3186 nova::spow_vec_simd(OUT(0), xa, IN(1), inNumSamples);
3187 unit->mPrevA = xa;
3191 FLATTEN void pow_ai_nova(BinaryOpUGen *unit, int inNumSamples)
3193 float xb = ZIN0(1);
3194 nova::spow_vec_simd(OUT(0), IN(0), xb, inNumSamples);
3195 unit->mPrevB = xb;
3197 #endif
3200 void ring1_aa(BinaryOpUGen *unit, int inNumSamples)
3202 float *out = ZOUT(0);
3203 float *a = ZIN(0);
3204 float *b = ZIN(1);
3206 LOOP1(inNumSamples,
3207 float xa = ZXP(a);
3208 float xb = ZXP(b);
3209 ZXP(out) = xa * xb + xa;
3213 void ring1_ak(BinaryOpUGen *unit, int inNumSamples)
3215 float *out = ZOUT(0);
3216 float *a = ZIN(0);
3217 float xb = unit->mPrevB;
3218 float next_b = ZIN0(1);
3220 if (xb == next_b) {
3221 if (xb == 0.f) {
3222 ZCopy(inNumSamples, out, a);
3223 } else if (xb == 1.f) {
3224 LOOP1(inNumSamples,
3225 float xa = ZXP(a);
3226 ZXP(out) = xa + xa;
3228 } else {
3229 LOOP1(inNumSamples,
3230 float xa = ZXP(a);
3231 ZXP(out) = xa * xb + xa;
3234 } else {
3235 float slope = CALCSLOPE(next_b, xb);
3236 LOOP1(inNumSamples,
3237 float xa = ZXP(a);
3238 ZXP(out) = xa * xb + xa;
3239 xb += slope;
3241 unit->mPrevB = xb;
3245 void ring1_ka(BinaryOpUGen *unit, int inNumSamples)
3247 float *out = ZOUT(0);
3248 float xa = unit->mPrevA;
3249 float *b = ZIN(1);
3250 float next_a = ZIN0(0);
3252 if (xa == next_a) {
3253 if (xa == 0.f) {
3254 LOOP1(inNumSamples,
3255 ZXP(out) = 0.f;
3257 } else {
3258 LOOP1(inNumSamples,
3259 float xb = ZXP(b);
3260 ZXP(out) = xa * xb + xa;
3263 } else {
3264 float slope = CALCSLOPE(next_a, xa);
3265 LOOP1(inNumSamples,
3266 float xb = ZXP(b);
3267 ZXP(out) = xa * xb + xa;
3268 xa += slope;
3270 unit->mPrevA = xa;
3274 void ring1_ia(BinaryOpUGen *unit, int inNumSamples)
3276 float *out = ZOUT(0);
3277 float xa = ZIN0(0);
3278 float *b = ZIN(1);
3280 LOOP1(inNumSamples,
3281 float xb = ZXP(b);
3282 ZXP(out) = xa * xb + xa;
3284 unit->mPrevA = xa;
3288 void ring1_ai(BinaryOpUGen *unit, int inNumSamples)
3290 float *out = ZOUT(0);
3291 float *a = ZIN(0);
3292 float xb = ZIN0(1);
3294 LOOP1(inNumSamples,
3295 float xa = ZXP(a);
3296 ZXP(out) = xa * xb + xa;
3298 unit->mPrevB = xb;
3304 void ring2_aa(BinaryOpUGen *unit, int inNumSamples)
3306 float *out = ZOUT(0);
3307 float *a = ZIN(0);
3308 float *b = ZIN(1);
3310 LOOP1(inNumSamples,
3311 float xa = ZXP(a);
3312 float xb = ZXP(b);
3313 ZXP(out) = xa * xb + xa + xb;
3317 void ring2_ak(BinaryOpUGen *unit, int inNumSamples)
3319 float *out = ZOUT(0);
3320 float *a = ZIN(0);
3321 float xb = unit->mPrevB;
3322 float next_b = ZIN0(1);
3324 if (xb == next_b) {
3325 if (xb == 0.f) {
3326 ZCopy(inNumSamples, out, a);
3327 } else {
3328 LOOP1(inNumSamples,
3329 float xa = ZXP(a);
3330 ZXP(out) = xa * xb + xa + xb;
3333 } else {
3334 float slope = CALCSLOPE(next_b, xb);
3335 LOOP1(inNumSamples,
3336 float xa = ZXP(a);
3337 ZXP(out) = xa * xb + xa + xb;
3338 xb += slope;
3340 unit->mPrevB = xb;
3344 void ring2_ka(BinaryOpUGen *unit, int inNumSamples)
3346 float *out = ZOUT(0);
3347 float xa = unit->mPrevA;
3348 float *b = ZIN(1);
3349 float next_a = ZIN0(0);
3351 if (xa == next_a) {
3352 if (xa == 0.f) {
3353 ZCopy(inNumSamples, out, b);
3354 } else {
3355 LOOP1(inNumSamples,
3356 float xb = ZXP(b);
3357 ZXP(out) = xa * xb + xa + xb;
3360 } else {
3361 float slope = CALCSLOPE(next_a, xa);
3362 LOOP1(inNumSamples,
3363 float xb = ZXP(b);
3364 ZXP(out) = xa * xb + xa + xb;
3365 xa += slope;
3367 unit->mPrevA = xa;
3371 void ring2_ia(BinaryOpUGen *unit, int inNumSamples)
3373 float *out = ZOUT(0);
3374 float xa = ZIN0(0);
3375 float *b = ZIN(1);
3377 LOOP1(inNumSamples,
3378 float xb = ZXP(b);
3379 ZXP(out) = xa * xb + xa + xb;
3381 unit->mPrevA = xa;
3385 void ring2_ai(BinaryOpUGen *unit, int inNumSamples)
3387 float *out = ZOUT(0);
3388 float *a = ZIN(0);
3389 float xb = ZIN0(1);
3391 LOOP1(inNumSamples,
3392 float xa = ZXP(a);
3393 ZXP(out) = xa * xb + xa + xb;
3395 unit->mPrevB = xb;
3401 void ring3_aa(BinaryOpUGen *unit, int inNumSamples)
3403 float *out = ZOUT(0);
3404 float *a = ZIN(0);
3405 float *b = ZIN(1);
3407 LOOP1(inNumSamples,
3408 float xa = ZXP(a);
3409 float xb = ZXP(b);
3410 ZXP(out) = xa * xa * xb;
3414 void ring3_ak(BinaryOpUGen *unit, int inNumSamples)
3416 float *out = ZOUT(0);
3417 float *a = ZIN(0);
3418 float xb = unit->mPrevB;
3419 float next_b = ZIN0(1);
3421 if (xb == next_b) {
3422 if (xb == 0.f) {
3423 ZClear(inNumSamples, out);
3424 } else if (xb == 1.f) {
3425 LOOP1(inNumSamples,
3426 float xa = ZXP(a);
3427 ZXP(out) = xa * xa;
3429 } else {
3430 LOOP1(inNumSamples,
3431 float xa = ZXP(a);
3432 ZXP(out) = xa * xa * xb;
3435 } else {
3436 float slope = CALCSLOPE(next_b, xb);
3437 LOOP1(inNumSamples,
3438 float xa = ZXP(a);
3439 ZXP(out) = xa * xa * xb;
3440 xb += slope;
3442 unit->mPrevB = xb;
3446 void ring3_ka(BinaryOpUGen *unit, int inNumSamples)
3448 float *out = ZOUT(0);
3449 float xa = unit->mPrevA;
3450 float *b = ZIN(1);
3451 float next_a = ZIN0(0);
3453 if (xa == next_a) {
3454 if (xa == 0.f) {
3455 ZClear(inNumSamples, out);
3456 } else if (xa == 1.f) {
3457 ZCopy(inNumSamples, out, b);
3458 } else {
3459 LOOP1(inNumSamples,
3460 float xb = ZXP(b);
3461 ZXP(out) = xa * xa * xb;
3464 } else {
3465 float slope = CALCSLOPE(next_a, xa);
3466 LOOP1(inNumSamples,
3467 float xb = ZXP(b);
3468 ZXP(out) = xa * xa * xb;
3469 xa += slope;
3471 unit->mPrevA = xa;
3475 void ring3_ia(BinaryOpUGen *unit, int inNumSamples)
3477 float *out = ZOUT(0);
3478 float xa = ZIN0(0);
3479 float *b = ZIN(1);
3481 LOOP1(inNumSamples,
3482 float xb = ZXP(b);
3483 ZXP(out) = xa * xa * xb;
3485 unit->mPrevA = xa;
3489 void ring3_ai(BinaryOpUGen *unit, int inNumSamples)
3491 float *out = ZOUT(0);
3492 float *a = ZIN(0);
3493 float xb = ZIN0(1);
3495 LOOP1(inNumSamples,
3496 float xa = ZXP(a);
3497 ZXP(out) = xa * xa * xb;
3499 unit->mPrevB = xb;
3504 void ring4_aa(BinaryOpUGen *unit, int inNumSamples)
3506 float *out = ZOUT(0);
3507 float *a = ZIN(0);
3508 float *b = ZIN(1);
3510 LOOP1(inNumSamples,
3511 float xa = ZXP(a);
3512 float xb = ZXP(b);
3513 ZXP(out) = xa * xa * xb - xa * xb * xb;
3517 void ring4_ak(BinaryOpUGen *unit, int inNumSamples)
3519 float *out = ZOUT(0);
3520 float *a = ZIN(0);
3521 float xb = unit->mPrevB;
3522 float next_b = ZIN0(1);
3524 if (xb == next_b) {
3525 if (xb == 0.f) {
3526 ZClear(inNumSamples, out);
3527 } else if (xb == 1.f) {
3528 LOOP1(inNumSamples,
3529 float xa = ZXP(a);
3530 ZXP(out) = xa * xa - xa;
3532 } else {
3533 LOOP1(inNumSamples,
3534 float xa = ZXP(a);
3535 ZXP(out) = xa * xa * xb - xa * xb * xb;
3538 } else {
3539 float slope = CALCSLOPE(next_b, xb);
3540 LOOP1(inNumSamples,
3541 float xa = ZXP(a);
3542 ZXP(out) = xa * xa * xb - xa * xb * xb;
3543 xb += slope;
3545 unit->mPrevB = xb;
3549 void ring4_ka(BinaryOpUGen *unit, int inNumSamples)
3551 float *out = ZOUT(0);
3552 float xa = unit->mPrevA;
3553 float *b = ZIN(1);
3554 float next_a = ZIN0(0);
3556 if (xa == next_a) {
3557 if (xa == 0.f) {
3558 ZClear(inNumSamples, out);
3559 } else if (xa == 1.f) {
3560 LOOP1(inNumSamples,
3561 float xb = ZXP(b);
3562 ZXP(out) = xb - xb * xb;
3564 } else {
3565 LOOP1(inNumSamples,
3566 float xb = ZXP(b);
3567 ZXP(out) = xa * xa * xb - xa * xb * xb;
3570 } else {
3571 float slope = CALCSLOPE(next_a, xa);
3572 LOOP1(inNumSamples,
3573 float xb = ZXP(b);
3574 ZXP(out) = xa * xa * xb - xa * xb * xb;
3575 xa += slope;
3577 unit->mPrevA = xa;
3581 void ring4_ia(BinaryOpUGen *unit, int inNumSamples)
3583 float *out = ZOUT(0);
3584 float xa = ZIN0(0);
3585 float *b = ZIN(1);
3587 LOOP1(inNumSamples,
3588 float xb = ZXP(b);
3589 ZXP(out) = xa * xa * xb - xa * xb * xb;
3591 unit->mPrevA = xa;
3595 void ring4_ai(BinaryOpUGen *unit, int inNumSamples)
3597 float *out = ZOUT(0);
3598 float *a = ZIN(0);
3599 float xb = ZIN0(1);
3601 LOOP1(inNumSamples,
3602 float xa = ZXP(a);
3603 ZXP(out) = xa * xa * xb - xa * xb * xb;
3605 unit->mPrevB = xb;
3610 void thresh_aa(BinaryOpUGen *unit, int inNumSamples)
3612 float *out = ZOUT(0);
3613 float *a = ZIN(0);
3614 float *b = ZIN(1);
3616 LOOP1(inNumSamples,
3617 float xa = ZXP(a);
3618 float xb = ZXP(b);
3619 ZXP(out) = xa < xb ? 0.f : xa;
3623 void thresh_ak(BinaryOpUGen *unit, int inNumSamples)
3625 float *out = ZOUT(0);
3626 float *a = ZIN(0);
3627 float xb = unit->mPrevB;
3628 float next_b = ZIN0(1);
3630 if (xb == next_b) {
3631 LOOP1(inNumSamples,
3632 float xa = ZXP(a);
3633 ZXP(out) = xa < xb ? 0.f : xa;
3635 } else {
3636 float slope = CALCSLOPE(next_b, xb);
3637 LOOP1(inNumSamples,
3638 float xa = ZXP(a);
3639 ZXP(out) = xa < xb ? 0.f : xa;
3640 xb += slope;
3642 unit->mPrevB = xb;
3646 void thresh_ka(BinaryOpUGen *unit, int inNumSamples)
3648 float *out = ZOUT(0);
3649 float xa = unit->mPrevA;
3650 float *b = ZIN(1);
3651 float next_a = ZIN0(0);
3653 if (xa == next_a) {
3654 LOOP1(inNumSamples,
3655 float xb = ZXP(b);
3656 ZXP(out) = xa < xb ? 0.f : xa;
3658 } else {
3659 float slope = CALCSLOPE(next_a, xa);
3660 LOOP1(inNumSamples,
3661 float xb = ZXP(b);
3662 ZXP(out) = xa < xb ? 0.f : xa;
3663 xa += slope;
3665 unit->mPrevA = xa;
3669 void thresh_ia(BinaryOpUGen *unit, int inNumSamples)
3671 float *out = ZOUT(0);
3672 float xa = ZIN0(0);
3673 float *b = ZIN(1);
3675 LOOP1(inNumSamples,
3676 float xb = ZXP(b);
3677 ZXP(out) = xa < xb ? 0.f : xa;
3679 unit->mPrevA = xa;
3683 void thresh_ai(BinaryOpUGen *unit, int inNumSamples)
3685 float *out = ZOUT(0);
3686 float *a = ZIN(0);
3687 float xb = ZIN0(1);
3689 LOOP1(inNumSamples,
3690 float xa = ZXP(a);
3691 ZXP(out) = xa < xb ? 0.f : xa;
3693 unit->mPrevB = xb;
3698 void clip2_aa(BinaryOpUGen *unit, int inNumSamples)
3700 float *out = ZOUT(0);
3701 float *a = ZIN(0);
3702 float *b = ZIN(1);
3704 LOOP1(inNumSamples,
3705 float xa = ZXP(a);
3706 float xb = ZXP(b);
3707 ZXP(out) = xa > xb ? xb : (xa < -xb ? -xb : xa);
3711 void clip2_ak(BinaryOpUGen *unit, int inNumSamples)
3713 float *out = ZOUT(0);
3714 float *a = ZIN(0);
3715 float xb = unit->mPrevB;
3716 float next_b = ZIN0(1);
3718 if (xb == next_b) {
3719 LOOP1(inNumSamples,
3720 float xa = ZXP(a);
3721 ZXP(out) = xa > xb ? xb : (xa < -xb ? -xb : xa);
3723 } else {
3724 float slope = CALCSLOPE(next_b, xb);
3725 LOOP1(inNumSamples,
3726 float xa = ZXP(a);
3727 ZXP(out) = xa > xb ? xb : (xa < -xb ? -xb : xa);
3728 xb += slope;
3730 unit->mPrevB = xb;
3734 void clip2_ka(BinaryOpUGen *unit, int inNumSamples)
3736 float *out = ZOUT(0);
3737 float xa = unit->mPrevA;
3738 float *b = ZIN(1);
3739 float next_a = ZIN0(0);
3741 if (xa == next_a) {
3742 LOOP1(inNumSamples,
3743 float xb = ZXP(b);
3744 ZXP(out) = xa > xb ? xb : (xa < -xb ? -xb : xa);
3746 } else {
3747 float slope = CALCSLOPE(next_a, xa);
3748 LOOP1(inNumSamples,
3749 float xb = ZXP(b);
3750 ZXP(out) = xa > xb ? xb : (xa < -xb ? -xb : xa);
3751 xa += slope;
3753 unit->mPrevA = xa;
3757 void clip2_ia(BinaryOpUGen *unit, int inNumSamples)
3759 float *out = ZOUT(0);
3760 float xa = ZIN0(0);
3761 float *b = ZIN(1);
3763 LOOP1(inNumSamples,
3764 float xb = ZXP(b);
3765 ZXP(out) = xa > xb ? xb : (xa < -xb ? -xb : xa);
3767 unit->mPrevA = xa;
3771 void clip2_ai(BinaryOpUGen *unit, int inNumSamples)
3773 float *out = ZOUT(0);
3774 float *a = ZIN(0);
3775 float xb = ZIN0(1);
3777 LOOP1(inNumSamples,
3778 float xa = ZXP(a);
3779 ZXP(out) = xa > xb ? xb : (xa < -xb ? -xb : xa);
3781 unit->mPrevB = xb;
3785 #ifdef NOVA_SIMD
3786 NOVA_BINARY_WRAPPER_K(clip2, clip2)
3787 #endif
3790 void excess_aa(BinaryOpUGen *unit, int inNumSamples)
3792 float *out = ZOUT(0);
3793 float *a = ZIN(0);
3794 float *b = ZIN(1);
3796 LOOP1(inNumSamples,
3797 float xa = ZXP(a);
3798 float xb = ZXP(b);
3799 ZXP(out) = xa > xb ? xa-xb : (xa < -xb ? xa+xb : 0.f);
3803 void excess_ak(BinaryOpUGen *unit, int inNumSamples)
3805 float *out = ZOUT(0);
3806 float *a = ZIN(0);
3807 float xb = unit->mPrevB;
3808 float next_b = ZIN0(1);
3810 if (xb == next_b) {
3811 LOOP1(inNumSamples,
3812 float xa = ZXP(a);
3813 ZXP(out) = xa > xb ? xa-xb : (xa < -xb ? xa+xb : 0.f);
3815 } else {
3816 float slope = CALCSLOPE(next_b, xb);
3817 LOOP1(inNumSamples,
3818 float xa = ZXP(a);
3819 ZXP(out) = xa > xb ? xa-xb : (xa < -xb ? xa+xb : 0.f);
3820 xb += slope;
3822 unit->mPrevB = xb;
3826 void excess_ka(BinaryOpUGen *unit, int inNumSamples)
3828 float *out = ZOUT(0);
3829 float xa = unit->mPrevA;
3830 float *b = ZIN(1);
3831 float next_a = ZIN0(0);
3833 if (xa == next_a) {
3834 LOOP1(inNumSamples,
3835 float xb = ZXP(b);
3836 ZXP(out) = xa > xb ? xa-xb : (xa < -xb ? xa+xb : 0.f);
3838 } else {
3839 float slope = CALCSLOPE(next_a, xa);
3840 LOOP1(inNumSamples,
3841 float xb = ZXP(b);
3842 ZXP(out) = xa > xb ? xa-xb : (xa < -xb ? xa+xb : 0.f);
3843 xa += slope;
3845 unit->mPrevA = xa;
3849 void excess_ia(BinaryOpUGen *unit, int inNumSamples)
3851 float *out = ZOUT(0);
3852 float xa = ZIN0(0);
3853 float *b = ZIN(1);
3855 LOOP1(inNumSamples,
3856 float xb = ZXP(b);
3857 ZXP(out) = xa > xb ? xa-xb : (xa < -xb ? xa+xb : 0.f);
3859 unit->mPrevA = xa;
3863 void excess_ai(BinaryOpUGen *unit, int inNumSamples)
3865 float *out = ZOUT(0);
3866 float *a = ZIN(0);
3867 float xb = ZIN0(1);
3869 LOOP1(inNumSamples,
3870 float xa = ZXP(a);
3871 ZXP(out) = xa > xb ? xa-xb : (xa < -xb ? xa+xb : 0.f);
3873 unit->mPrevB = xb;
3878 void lt_aa(BinaryOpUGen *unit, int inNumSamples)
3880 float *out = ZOUT(0);
3881 float *a = ZIN(0);
3882 float *b = ZIN(1);
3884 LOOP1(inNumSamples,
3885 float xa = ZXP(a);
3886 float xb = ZXP(b);
3887 ZXP(out) = xa < xb ? 1.f : 0.f;
3891 #ifdef NOVA_SIMD
3892 NOVA_BINARY_WRAPPER_K(lt, less)
3893 #endif
3896 void lt_ak(BinaryOpUGen *unit, int inNumSamples)
3898 float *out = ZOUT(0);
3899 float *a = ZIN(0);
3900 float xb = unit->mPrevB;
3901 float next_b = ZIN0(1);
3903 if (xb == next_b) {
3904 LOOP1(inNumSamples,
3905 float xa = ZXP(a);
3906 ZXP(out) = xa < xb ? 1.f : 0.f;
3908 } else {
3909 float slope = CALCSLOPE(next_b, xb);
3910 LOOP1(inNumSamples,
3911 float xa = ZXP(a);
3912 ZXP(out) = xa < xb ? 1.f : 0.f;
3913 xb += slope;
3915 unit->mPrevB = xb;
3919 void lt_ka(BinaryOpUGen *unit, int inNumSamples)
3921 float *out = ZOUT(0);
3922 float xa = unit->mPrevA;
3923 float *b = ZIN(1);
3924 float next_a = ZIN0(0);
3926 if (xa == next_a) {
3927 LOOP1(inNumSamples,
3928 float xb = ZXP(b);
3929 ZXP(out) = xa < xb ? 1.f : 0.f;
3931 } else {
3932 float slope = CALCSLOPE(next_a, xa);
3933 LOOP1(inNumSamples,
3934 float xb = ZXP(b);
3935 ZXP(out) = xa < xb ? 1.f : 0.f;
3936 xa += slope;
3938 unit->mPrevA = xa;
3942 void lt_ia(BinaryOpUGen *unit, int inNumSamples)
3944 float *out = ZOUT(0);
3945 float xa = ZIN0(0);
3946 float *b = ZIN(1);
3948 LOOP1(inNumSamples,
3949 float xb = ZXP(b);
3950 ZXP(out) = xa < xb ? 1.f : 0.f;
3952 unit->mPrevA = xa;
3956 void lt_ai(BinaryOpUGen *unit, int inNumSamples)
3958 float *out = ZOUT(0);
3959 float *a = ZIN(0);
3960 float xb = ZIN0(1);
3962 LOOP1(inNumSamples,
3963 float xa = ZXP(a);
3964 ZXP(out) = xa < xb ? 1.f : 0.f;
3966 unit->mPrevB = xb;
3971 void le_aa(BinaryOpUGen *unit, int inNumSamples)
3973 float *out = ZOUT(0);
3974 float *a = ZIN(0);
3975 float *b = ZIN(1);
3977 LOOP1(inNumSamples,
3978 float xa = ZXP(a);
3979 float xb = ZXP(b);
3980 ZXP(out) = xa <= xb ? 1.f : 0.f;
3984 #ifdef NOVA_SIMD
3985 NOVA_BINARY_WRAPPER_K(le, less_equal)
3986 #endif
3988 void le_ak(BinaryOpUGen *unit, int inNumSamples)
3990 float *out = ZOUT(0);
3991 float *a = ZIN(0);
3992 float xb = unit->mPrevB;
3993 float next_b = ZIN0(1);
3995 if (xb == next_b) {
3996 LOOP1(inNumSamples,
3997 float xa = ZXP(a);
3998 ZXP(out) = xa <= xb ? 1.f : 0.f;
4000 } else {
4001 float slope = CALCSLOPE(next_b, xb);
4002 LOOP1(inNumSamples,
4003 float xa = ZXP(a);
4004 ZXP(out) = xa <= xb ? 1.f : 0.f;
4005 xb += slope;
4007 unit->mPrevB = xb;
4011 void le_ka(BinaryOpUGen *unit, int inNumSamples)
4013 float *out = ZOUT(0);
4014 float xa = unit->mPrevA;
4015 float *b = ZIN(1);
4016 float next_a = ZIN0(0);
4018 if (xa == next_a) {
4019 LOOP1(inNumSamples,
4020 float xb = ZXP(b);
4021 ZXP(out) = xa <= xb ? 1.f : 0.f;
4023 } else {
4024 float slope = CALCSLOPE(next_a, xa);
4025 LOOP1(inNumSamples,
4026 float xb = ZXP(b);
4027 ZXP(out) = xa <= xb ? 1.f : 0.f;
4028 xa += slope;
4030 unit->mPrevA = xa;
4034 void le_ia(BinaryOpUGen *unit, int inNumSamples)
4036 float *out = ZOUT(0);
4037 float xa = ZIN0(0);
4038 float *b = ZIN(1);
4040 LOOP1(inNumSamples,
4041 float xb = ZXP(b);
4042 ZXP(out) = xa <= xb ? 1.f : 0.f;
4044 unit->mPrevA = xa;
4048 void le_ai(BinaryOpUGen *unit, int inNumSamples)
4050 float *out = ZOUT(0);
4051 float *a = ZIN(0);
4052 float xb = ZIN0(1);
4054 LOOP1(inNumSamples,
4055 float xa = ZXP(a);
4056 ZXP(out) = xa <= xb ? 1.f : 0.f;
4058 unit->mPrevB = xb;
4063 void gt_aa(BinaryOpUGen *unit, int inNumSamples)
4065 float *out = ZOUT(0);
4066 float *a = ZIN(0);
4067 float *b = ZIN(1);
4069 LOOP1(inNumSamples,
4070 float xa = ZXP(a);
4071 float xb = ZXP(b);
4072 ZXP(out) = xa > xb ? 1.f : 0.f;
4076 #ifdef NOVA_SIMD
4077 NOVA_BINARY_WRAPPER_K(gt, greater)
4078 #endif
4081 void gt_ak(BinaryOpUGen *unit, int inNumSamples)
4083 float *out = ZOUT(0);
4084 float *a = ZIN(0);
4085 float xb = unit->mPrevB;
4086 float next_b = ZIN0(1);
4088 if (xb == next_b) {
4089 LOOP1(inNumSamples,
4090 float xa = ZXP(a);
4091 ZXP(out) = xa > xb ? 1.f : 0.f;
4093 } else {
4094 float slope = CALCSLOPE(next_b, xb);
4095 LOOP1(inNumSamples,
4096 float xa = ZXP(a);
4097 ZXP(out) = xa > xb ? 1.f : 0.f;
4098 xb += slope;
4100 unit->mPrevB = xb;
4104 void gt_ka(BinaryOpUGen *unit, int inNumSamples)
4106 float *out = ZOUT(0);
4107 float xa = unit->mPrevA;
4108 float *b = ZIN(1);
4109 float next_a = ZIN0(0);
4111 if (xa == next_a) {
4112 LOOP1(inNumSamples,
4113 float xb = ZXP(b);
4114 ZXP(out) = xa > xb ? 1.f : 0.f;
4116 } else {
4117 float slope = CALCSLOPE(next_a, xa);
4118 LOOP1(inNumSamples,
4119 float xb = ZXP(b);
4120 ZXP(out) = xa > xb ? 1.f : 0.f;
4121 xa += slope;
4123 unit->mPrevA = xa;
4127 void gt_ia(BinaryOpUGen *unit, int inNumSamples)
4129 float *out = ZOUT(0);
4130 float xa = ZIN0(0);
4131 float *b = ZIN(1);
4133 LOOP1(inNumSamples,
4134 float xb = ZXP(b);
4135 ZXP(out) = xa > xb ? 1.f : 0.f;
4137 unit->mPrevA = xa;
4141 void gt_ai(BinaryOpUGen *unit, int inNumSamples)
4143 float *out = ZOUT(0);
4144 float *a = ZIN(0);
4145 float xb = ZIN0(1);
4147 LOOP1(inNumSamples,
4148 float xa = ZXP(a);
4149 ZXP(out) = xa > xb ? 1.f : 0.f;
4151 unit->mPrevB = xb;
4156 void ge_aa(BinaryOpUGen *unit, int inNumSamples)
4158 float *out = ZOUT(0);
4159 float *a = ZIN(0);
4160 float *b = ZIN(1);
4162 LOOP1(inNumSamples,
4163 float xa = ZXP(a);
4164 float xb = ZXP(b);
4165 ZXP(out) = xa >= xb ? 1.f : 0.f;
4169 #ifdef NOVA_SIMD
4170 NOVA_BINARY_WRAPPER_K(ge, greater_equal)
4171 #endif
4174 void ge_ak(BinaryOpUGen *unit, int inNumSamples)
4176 float *out = ZOUT(0);
4177 float *a = ZIN(0);
4178 float xb = unit->mPrevB;
4179 float next_b = ZIN0(1);
4181 if (xb == next_b) {
4182 LOOP1(inNumSamples,
4183 float xa = ZXP(a);
4184 ZXP(out) = xa >= xb ? 1.f : 0.f;
4186 } else {
4187 float slope = CALCSLOPE(next_b, xb);
4188 LOOP1(inNumSamples,
4189 float xa = ZXP(a);
4190 ZXP(out) = xa >= xb ? 1.f : 0.f;
4191 xb += slope;
4193 unit->mPrevB = xb;
4197 void ge_ka(BinaryOpUGen *unit, int inNumSamples)
4199 float *out = ZOUT(0);
4200 float xa = unit->mPrevA;
4201 float *b = ZIN(1);
4202 float next_a = ZIN0(0);
4204 if (xa == next_a) {
4205 LOOP1(inNumSamples,
4206 float xb = ZXP(b);
4207 ZXP(out) = xa >= xb ? 1.f : 0.f;
4209 } else {
4210 float slope = CALCSLOPE(next_a, xa);
4211 LOOP1(inNumSamples,
4212 float xb = ZXP(b);
4213 ZXP(out) = xa >= xb ? 1.f : 0.f;
4214 xa += slope;
4216 unit->mPrevA = xa;
4220 void ge_ia(BinaryOpUGen *unit, int inNumSamples)
4222 float *out = ZOUT(0);
4223 float xa = ZIN0(0);
4224 float *b = ZIN(1);
4226 LOOP1(inNumSamples,
4227 float xb = ZXP(b);
4228 ZXP(out) = xa >= xb ? 1.f : 0.f;
4230 unit->mPrevA = xa;
4234 void ge_ai(BinaryOpUGen *unit, int inNumSamples)
4236 float *out = ZOUT(0);
4237 float *a = ZIN(0);
4238 float xb = ZIN0(1);
4240 LOOP1(inNumSamples,
4241 float xa = ZXP(a);
4242 ZXP(out) = xa >= xb ? 1.f : 0.f;
4244 unit->mPrevB = xb;
4249 void eq_aa(BinaryOpUGen *unit, int inNumSamples)
4251 float *out = ZOUT(0);
4252 float *a = ZIN(0);
4253 float *b = ZIN(1);
4255 LOOP1(inNumSamples,
4256 float xa = ZXP(a);
4257 float xb = ZXP(b);
4258 ZXP(out) = xa == xb ? 1.f : 0.f;
4262 #ifdef NOVA_SIMD
4263 NOVA_BINARY_WRAPPER_K(eq, equal)
4264 #endif
4266 void eq_ak(BinaryOpUGen *unit, int inNumSamples)
4268 float *out = ZOUT(0);
4269 float *a = ZIN(0);
4270 float xb = unit->mPrevB;
4271 float next_b = ZIN0(1);
4273 if (xb == next_b) {
4274 LOOP1(inNumSamples,
4275 float xa = ZXP(a);
4276 ZXP(out) = xa == xb ? 1.f : 0.f;
4278 } else {
4279 float slope = CALCSLOPE(next_b, xb);
4280 LOOP1(inNumSamples,
4281 float xa = ZXP(a);
4282 ZXP(out) = xa == xb ? 1.f : 0.f;
4283 xb += slope;
4285 unit->mPrevB = xb;
4289 void eq_ka(BinaryOpUGen *unit, int inNumSamples)
4291 float *out = ZOUT(0);
4292 float xa = unit->mPrevA;
4293 float *b = ZIN(1);
4294 float next_a = ZIN0(0);
4296 if (xa == next_a) {
4297 LOOP1(inNumSamples,
4298 float xb = ZXP(b);
4299 ZXP(out) = xa == xb ? 1.f : 0.f;
4301 } else {
4302 float slope = CALCSLOPE(next_a, xa);
4303 LOOP1(inNumSamples,
4304 float xb = ZXP(b);
4305 ZXP(out) = xa == xb ? 1.f : 0.f;
4306 xa += slope;
4308 unit->mPrevA = xa;
4312 void eq_ia(BinaryOpUGen *unit, int inNumSamples)
4314 float *out = ZOUT(0);
4315 float xa = ZIN0(0);
4316 float *b = ZIN(1);
4318 LOOP1(inNumSamples,
4319 float xb = ZXP(b);
4320 ZXP(out) = xa == xb ? 1.f : 0.f;
4322 unit->mPrevA = xa;
4326 void eq_ai(BinaryOpUGen *unit, int inNumSamples)
4328 float *out = ZOUT(0);
4329 float *a = ZIN(0);
4330 float xb = ZIN0(1);
4332 LOOP1(inNumSamples,
4333 float xa = ZXP(a);
4334 ZXP(out) = xa == xb ? 1.f : 0.f;
4336 unit->mPrevB = xb;
4341 void neq_aa(BinaryOpUGen *unit, int inNumSamples)
4343 float *out = ZOUT(0);
4344 float *a = ZIN(0);
4345 float *b = ZIN(1);
4347 LOOP1(inNumSamples,
4348 float xa = ZXP(a);
4349 float xb = ZXP(b);
4350 ZXP(out) = xa != xb ? 1.f : 0.f;
4354 #ifdef NOVA_SIMD
4355 NOVA_BINARY_WRAPPER_K(neq, notequal)
4356 #endif
4359 void neq_ak(BinaryOpUGen *unit, int inNumSamples)
4361 float *out = ZOUT(0);
4362 float *a = ZIN(0);
4363 float xb = unit->mPrevB;
4364 float next_b = ZIN0(1);
4366 if (xb == next_b) {
4367 LOOP1(inNumSamples,
4368 float xa = ZXP(a);
4369 ZXP(out) = xa != xb ? 1.f : 0.f;
4371 } else {
4372 float slope = CALCSLOPE(next_b, xb);
4373 LOOP1(inNumSamples,
4374 float xa = ZXP(a);
4375 ZXP(out) = xa != xb ? 1.f : 0.f;
4376 xb += slope;
4378 unit->mPrevB = xb;
4382 void neq_ka(BinaryOpUGen *unit, int inNumSamples)
4384 float *out = ZOUT(0);
4385 float xa = unit->mPrevA;
4386 float *b = ZIN(1);
4387 float next_a = ZIN0(0);
4389 if (xa == next_a) {
4390 LOOP1(inNumSamples,
4391 float xb = ZXP(b);
4392 ZXP(out) = xa != xb ? 1.f : 0.f;
4394 } else {
4395 float slope = CALCSLOPE(next_a, xa);
4396 LOOP1(inNumSamples,
4397 float xb = ZXP(b);
4398 ZXP(out) = xa != xb ? 1.f : 0.f;
4399 xa += slope;
4401 unit->mPrevA = xa;
4405 void neq_ia(BinaryOpUGen *unit, int inNumSamples)
4407 float *out = ZOUT(0);
4408 float xa = ZIN0(0);
4409 float *b = ZIN(1);
4411 LOOP1(inNumSamples,
4412 float xb = ZXP(b);
4413 ZXP(out) = xa != xb ? 1.f : 0.f;
4415 unit->mPrevA = xa;
4419 void neq_ai(BinaryOpUGen *unit, int inNumSamples)
4421 float *out = ZOUT(0);
4422 float *a = ZIN(0);
4423 float xb = ZIN0(1);
4425 LOOP1(inNumSamples,
4426 float xa = ZXP(a);
4427 ZXP(out) = xa != xb ? 1.f : 0.f;
4429 unit->mPrevB = xb;
4433 void sumsqr_aa(BinaryOpUGen *unit, int inNumSamples)
4435 float *out = ZOUT(0);
4436 float *a = ZIN(0);
4437 float *b = ZIN(1);
4439 LOOP1(inNumSamples,
4440 float xa = ZXP(a);
4441 float xb = ZXP(b);
4442 ZXP(out) = xa * xa + xb * xb;
4446 void sumsqr_ak(BinaryOpUGen *unit, int inNumSamples)
4448 float *out = ZOUT(0);
4449 float *a = ZIN(0);
4450 float xb = unit->mPrevB;
4451 float next_b = ZIN0(1);
4453 if (xb == next_b) {
4454 LOOP1(inNumSamples,
4455 float xa = ZXP(a);
4456 ZXP(out) = xa * xa + xb * xb;
4458 } else {
4459 float slope = CALCSLOPE(next_b, xb);
4460 LOOP1(inNumSamples,
4461 float xa = ZXP(a);
4462 ZXP(out) = xa * xa + xb * xb;
4463 xb += slope;
4465 unit->mPrevB = xb;
4469 void sumsqr_ka(BinaryOpUGen *unit, int inNumSamples)
4471 float *out = ZOUT(0);
4472 float xa = unit->mPrevA;
4473 float *b = ZIN(1);
4474 float next_a = ZIN0(0);
4476 if (xa == next_a) {
4477 LOOP1(inNumSamples,
4478 float xb = ZXP(b);
4479 ZXP(out) = xa * xa + xb * xb;
4481 } else {
4482 float slope = CALCSLOPE(next_a, xa);
4483 LOOP1(inNumSamples,
4484 float xb = ZXP(b);
4485 ZXP(out) = xa * xa + xb * xb;
4486 xa += slope;
4488 unit->mPrevA = xa;
4493 void sumsqr_ia(BinaryOpUGen *unit, int inNumSamples)
4495 float *out = ZOUT(0);
4496 float xa = ZIN0(0);
4497 float *b = ZIN(1);
4499 LOOP1(inNumSamples,
4500 float xb = ZXP(b);
4501 ZXP(out) = xa * xa + xb * xb;
4503 unit->mPrevA = xa;
4507 void sumsqr_ai(BinaryOpUGen *unit, int inNumSamples)
4509 float *out = ZOUT(0);
4510 float *a = ZIN(0);
4511 float xb = ZIN0(1);
4513 LOOP1(inNumSamples,
4514 float xa = ZXP(a);
4515 ZXP(out) = xa * xa + xb * xb;
4517 unit->mPrevB = xb;
4522 void difsqr_aa(BinaryOpUGen *unit, int inNumSamples)
4524 float *out = ZOUT(0);
4525 float *a = ZIN(0);
4526 float *b = ZIN(1);
4528 LOOP1(inNumSamples,
4529 float xa = ZXP(a);
4530 float xb = ZXP(b);
4531 ZXP(out) = xa * xa - xb * xb;
4535 void difsqr_ak(BinaryOpUGen *unit, int inNumSamples)
4537 float *out = ZOUT(0);
4538 float *a = ZIN(0);
4539 float xb = unit->mPrevB;
4540 float next_b = ZIN0(1);
4542 if (xb == next_b) {
4543 LOOP1(inNumSamples,
4544 float xa = ZXP(a);
4545 ZXP(out) = xa * xa - xb * xb;
4547 } else {
4548 float slope = CALCSLOPE(next_b, xb);
4549 LOOP1(inNumSamples,
4550 float xa = ZXP(a);
4551 ZXP(out) = xa * xa - xb * xb;
4552 xb += slope;
4554 unit->mPrevB = xb;
4558 void difsqr_ka(BinaryOpUGen *unit, int inNumSamples)
4560 float *out = ZOUT(0);
4561 float xa = unit->mPrevA;
4562 float *b = ZIN(1);
4563 float next_a = ZIN0(0);
4565 if (xa == next_a) {
4566 LOOP1(inNumSamples,
4567 float xb = ZXP(b);
4568 ZXP(out) = xa * xa - xb * xb;
4570 } else {
4571 float slope = CALCSLOPE(next_a, xa);
4572 LOOP1(inNumSamples,
4573 float xb = ZXP(b);
4574 ZXP(out) = xa * xa - xb * xb;
4575 xa += slope;
4577 unit->mPrevA = xa;
4581 void difsqr_ia(BinaryOpUGen *unit, int inNumSamples)
4583 float *out = ZOUT(0);
4584 float xa = ZIN0(0);
4585 float *b = ZIN(1);
4587 LOOP1(inNumSamples,
4588 float xb = ZXP(b);
4589 ZXP(out) = xa * xa - xb * xb;
4591 unit->mPrevA = xa;
4595 void difsqr_ai(BinaryOpUGen *unit, int inNumSamples)
4597 float *out = ZOUT(0);
4598 float *a = ZIN(0);
4599 float xb = ZIN0(1);
4601 LOOP1(inNumSamples,
4602 float xa = ZXP(a);
4603 ZXP(out) = xa * xa - xb * xb;
4605 unit->mPrevB = xb;
4609 void sqrsum_aa(BinaryOpUGen *unit, int inNumSamples)
4611 float *out = ZOUT(0);
4612 float *a = ZIN(0);
4613 float *b = ZIN(1);
4615 LOOP1(inNumSamples,
4616 float sum = ZXP(a) + ZXP(b);
4617 ZXP(out) = sum * sum;
4621 void sqrsum_ak(BinaryOpUGen *unit, int inNumSamples)
4623 float *out = ZOUT(0);
4624 float *a = ZIN(0);
4625 float xb = unit->mPrevB;
4626 float next_b = ZIN0(1);
4628 if (xb == next_b) {
4629 LOOP1(inNumSamples,
4630 float xa = ZXP(a);
4631 float sum = xa + xb;
4632 ZXP(out) = sum * sum;
4634 } else {
4635 float slope = CALCSLOPE(next_b, xb);
4636 LOOP1(inNumSamples,
4637 float xa = ZXP(a);
4638 float sum = xa + xb;
4639 ZXP(out) = sum * sum;
4640 xb += slope;
4642 unit->mPrevB = xb;
4646 void sqrsum_ka(BinaryOpUGen *unit, int inNumSamples)
4648 float *out = ZOUT(0);
4649 float xa = unit->mPrevA;
4650 float *b = ZIN(1);
4651 float next_a = ZIN0(0);
4653 if (xa == next_a) {
4654 LOOP1(inNumSamples,
4655 float xb = ZXP(b);
4656 float sum = xa + xb;
4657 ZXP(out) = sum * sum;
4659 } else {
4660 float slope = CALCSLOPE(next_a, xa);
4661 LOOP1(inNumSamples,
4662 float xb = ZXP(b);
4663 float sum = xa + xb;
4664 ZXP(out) = sum * sum;
4665 xa += slope;
4667 unit->mPrevA = xa;
4671 void sqrsum_ia(BinaryOpUGen *unit, int inNumSamples)
4673 float *out = ZOUT(0);
4674 float xa = ZIN0(0);
4675 float *b = ZIN(1);
4677 LOOP1(inNumSamples,
4678 float xb = ZXP(b);
4679 float sum = xa + xb;
4680 ZXP(out) = sum * sum;
4682 unit->mPrevA = xa;
4686 void sqrsum_ai(BinaryOpUGen *unit, int inNumSamples)
4688 float *out = ZOUT(0);
4689 float *a = ZIN(0);
4690 float xb = ZIN0(1);
4692 LOOP1(inNumSamples,
4693 float xa = ZXP(a);
4694 float sum = xa + xb;
4695 ZXP(out) = sum * sum;
4697 unit->mPrevB = xb;
4701 void sqrdif_aa(BinaryOpUGen *unit, int inNumSamples)
4703 float *out = ZOUT(0);
4704 float *a = ZIN(0);
4705 float *b = ZIN(1);
4707 LOOP1(inNumSamples,
4708 float dif = ZXP(a) - ZXP(b);
4709 ZXP(out) = dif * dif;
4713 void sqrdif_ak(BinaryOpUGen *unit, int inNumSamples)
4715 float *out = ZOUT(0);
4716 float *a = ZIN(0);
4717 float xb = unit->mPrevB;
4718 float next_b = ZIN0(1);
4720 if (xb == next_b) {
4721 LOOP1(inNumSamples,
4722 float xa = ZXP(a);
4723 float dif = xa - xb;
4724 ZXP(out) = dif * dif;
4726 } else {
4727 float slope = CALCSLOPE(next_b, xb);
4728 LOOP1(inNumSamples,
4729 float xa = ZXP(a);
4730 float dif = xa - xb;
4731 ZXP(out) = dif * dif;
4732 xb += slope;
4734 unit->mPrevB = xb;
4738 void sqrdif_ka(BinaryOpUGen *unit, int inNumSamples)
4740 float *out = ZOUT(0);
4741 float xa = unit->mPrevA;
4742 float *b = ZIN(1);
4743 float next_a = ZIN0(0);
4745 if (xa == next_a) {
4746 LOOP1(inNumSamples,
4747 float xb = ZXP(b);
4748 float dif = xa - xb;
4749 ZXP(out) = dif * dif;
4751 } else {
4752 float slope = CALCSLOPE(next_a, xa);
4753 LOOP1(inNumSamples,
4754 float xb = ZXP(b);
4755 float dif = xa - xb;
4756 ZXP(out) = dif * dif;
4757 xa += slope;
4759 unit->mPrevA = xa;
4764 void sqrdif_ia(BinaryOpUGen *unit, int inNumSamples)
4766 float *out = ZOUT(0);
4767 float xa = ZIN0(0);
4768 float *b = ZIN(1);
4770 LOOP1(inNumSamples,
4771 float xb = ZXP(b);
4772 float dif = xa - xb;
4773 ZXP(out) = dif * dif;
4775 unit->mPrevA = xa;
4779 void sqrdif_ai(BinaryOpUGen *unit, int inNumSamples)
4781 float *out = ZOUT(0);
4782 float *a = ZIN(0);
4783 float xb = ZIN0(1);
4785 LOOP1(inNumSamples,
4786 float xa = ZXP(a);
4787 float dif = xa - xb;
4788 ZXP(out) = dif * dif;
4790 unit->mPrevB = xb;
4794 void absdif_aa(BinaryOpUGen *unit, int inNumSamples)
4796 float *out = ZOUT(0);
4797 float *a = ZIN(0);
4798 float *b = ZIN(1);
4800 LOOP1(inNumSamples,
4801 float dif = ZXP(a) - ZXP(b);
4802 ZXP(out) = fabs(dif);
4806 void absdif_ak(BinaryOpUGen *unit, int inNumSamples)
4808 float *out = ZOUT(0);
4809 float *a = ZIN(0);
4810 float xb = unit->mPrevB;
4811 float next_b = ZIN0(1);
4813 if (xb == next_b) {
4814 LOOP1(inNumSamples,
4815 float xa = ZXP(a);
4816 float dif = xa - xb;
4817 ZXP(out) = fabs(dif);
4819 } else {
4820 float slope = CALCSLOPE(next_b, xb);
4821 LOOP1(inNumSamples,
4822 float xa = ZXP(a);
4823 float dif = xa - xb;
4824 ZXP(out) = fabs(dif);
4825 xb += slope;
4827 unit->mPrevB = xb;
4831 void absdif_ka(BinaryOpUGen *unit, int inNumSamples)
4833 float *out = ZOUT(0);
4834 float xa = unit->mPrevA;
4835 float *b = ZIN(1);
4836 float next_a = ZIN0(0);
4838 if (xa == next_a) {
4839 LOOP1(inNumSamples,
4840 float xb = ZXP(b);
4841 float dif = xa - xb;
4842 ZXP(out) = fabs(dif);
4844 } else {
4845 float slope = CALCSLOPE(next_a, xa);
4846 LOOP1(inNumSamples,
4847 float xb = ZXP(b);
4848 float dif = xa - xb;
4849 ZXP(out) = fabs(dif);
4850 xa += slope;
4852 unit->mPrevA = xa;
4856 void absdif_ia(BinaryOpUGen *unit, int inNumSamples)
4858 float *out = ZOUT(0);
4859 float xa = ZIN0(0);
4860 float *b = ZIN(1);
4862 LOOP1(inNumSamples,
4863 float xb = ZXP(b);
4864 float dif = xa - xb;
4865 ZXP(out) = fabs(dif);
4867 unit->mPrevA = xa;
4871 void absdif_ai(BinaryOpUGen *unit, int inNumSamples)
4873 float *out = ZOUT(0);
4874 float *a = ZIN(0);
4875 float xb = ZIN0(1);
4877 LOOP1(inNumSamples,
4878 float xa = ZXP(a);
4879 float dif = xa - xb;
4880 ZXP(out) = fabs(dif);
4882 unit->mPrevB = xb;
4886 void round_aa(BinaryOpUGen *unit, int inNumSamples)
4888 float *out = ZOUT(0);
4889 float *a = ZIN(0);
4890 float *b = ZIN(1);
4892 LOOP1(inNumSamples,
4893 float xa = ZXP(a);
4894 float xb = ZXP(b);
4895 ZXP(out) = sc_round(xa, xb);
4899 void round_ak(BinaryOpUGen *unit, int inNumSamples)
4901 float *out = ZOUT(0);
4902 float *a = ZIN(0);
4903 float xb = unit->mPrevB;
4904 float next_b = ZIN0(1);
4906 if (xb == next_b) {
4907 LOOP1(inNumSamples,
4908 float xa = ZXP(a);
4909 ZXP(out) = sc_round(xa, xb);
4911 } else {
4912 float slope = CALCSLOPE(next_b, xb);
4913 LOOP1(inNumSamples,
4914 float xa = ZXP(a);
4915 ZXP(out) = sc_round(xa, xb);
4916 xb += slope;
4918 unit->mPrevB = xb;
4922 void round_ka(BinaryOpUGen *unit, int inNumSamples)
4924 float *out = ZOUT(0);
4925 float xa = unit->mPrevA;
4926 float *b = ZIN(1);
4927 float next_a = ZIN0(0);
4929 if (xa == next_a) {
4930 LOOP1(inNumSamples,
4931 float xb = ZXP(b);
4932 ZXP(out) = sc_round(xa, xb);
4934 } else {
4935 float slope = CALCSLOPE(next_a, xa);
4936 LOOP1(inNumSamples,
4937 float xb = ZXP(b);
4938 ZXP(out) = sc_round(xa, xb);
4939 xa += slope;
4941 unit->mPrevA = xa;
4946 void round_ia(BinaryOpUGen *unit, int inNumSamples)
4948 float *out = ZOUT(0);
4949 float xa = ZIN0(0);
4950 float *b = ZIN(1);
4952 LOOP1(inNumSamples,
4953 float xb = ZXP(b);
4954 ZXP(out) = sc_round(xa, xb);
4956 unit->mPrevA = xa;
4960 void round_ai(BinaryOpUGen *unit, int inNumSamples)
4962 float *out = ZOUT(0);
4963 float *a = ZIN(0);
4964 float xb = ZIN0(1);
4966 LOOP1(inNumSamples,
4967 float xa = ZXP(a);
4968 ZXP(out) = sc_round(xa, xb);
4970 unit->mPrevB = xb;
4976 void roundUp_aa(BinaryOpUGen *unit, int inNumSamples)
4978 float *out = ZOUT(0);
4979 float *a = ZIN(0);
4980 float *b = ZIN(1);
4982 LOOP1(inNumSamples,
4983 float xa = ZXP(a);
4984 float xb = ZXP(b);
4985 ZXP(out) = sc_roundUp(xa, xb);
4989 void roundUp_ak(BinaryOpUGen *unit, int inNumSamples)
4991 float *out = ZOUT(0);
4992 float *a = ZIN(0);
4993 float xb = unit->mPrevB;
4994 float next_b = ZIN0(1);
4996 if (xb == next_b) {
4997 LOOP1(inNumSamples,
4998 float xa = ZXP(a);
4999 ZXP(out) = sc_roundUp(xa, xb);
5001 } else {
5002 float slope = CALCSLOPE(next_b, xb);
5003 LOOP1(inNumSamples,
5004 float xa = ZXP(a);
5005 ZXP(out) = sc_roundUp(xa, xb);
5006 xb += slope;
5008 unit->mPrevB = xb;
5012 void roundUp_ka(BinaryOpUGen *unit, int inNumSamples)
5014 float *out = ZOUT(0);
5015 float xa = unit->mPrevA;
5016 float *b = ZIN(1);
5017 float next_a = ZIN0(0);
5019 if (xa == next_a) {
5020 LOOP1(inNumSamples,
5021 float xb = ZXP(b);
5022 ZXP(out) = sc_roundUp(xa, xb);
5024 } else {
5025 float slope = CALCSLOPE(next_a, xa);
5026 LOOP1(inNumSamples,
5027 float xb = ZXP(b);
5028 ZXP(out) = sc_roundUp(xa, xb);
5029 xa += slope;
5031 unit->mPrevA = xa;
5036 void roundUp_ia(BinaryOpUGen *unit, int inNumSamples)
5038 float *out = ZOUT(0);
5039 float xa = ZIN0(0);
5040 float *b = ZIN(1);
5042 LOOP1(inNumSamples,
5043 float xb = ZXP(b);
5044 ZXP(out) = sc_roundUp(xa, xb);
5046 unit->mPrevA = xa;
5050 void roundUp_ai(BinaryOpUGen *unit, int inNumSamples)
5052 float *out = ZOUT(0);
5053 float *a = ZIN(0);
5054 float xb = ZIN0(1);
5056 LOOP1(inNumSamples,
5057 float xa = ZXP(a);
5058 ZXP(out) = sc_roundUp(xa, xb);
5060 unit->mPrevB = xb;
5065 void trunc_aa(BinaryOpUGen *unit, int inNumSamples)
5067 float *out = ZOUT(0);
5068 float *a = ZIN(0);
5069 float *b = ZIN(1);
5071 LOOP1(inNumSamples,
5072 float xa = ZXP(a);
5073 float xb = ZXP(b);
5074 ZXP(out) = sc_trunc(xa, xb);
5078 void trunc_ak(BinaryOpUGen *unit, int inNumSamples)
5080 float *out = ZOUT(0);
5081 float *a = ZIN(0);
5082 float xb = unit->mPrevB;
5083 float next_b = ZIN0(1);
5085 if (xb == next_b) {
5086 LOOP1(inNumSamples,
5087 float xa = ZXP(a);
5088 ZXP(out) = sc_trunc(xa, xb);
5090 } else {
5091 float slope = CALCSLOPE(next_b, xb);
5092 LOOP1(inNumSamples,
5093 float xa = ZXP(a);
5094 ZXP(out) = sc_trunc(xa, xb);
5095 xb += slope;
5097 unit->mPrevB = xb;
5101 void trunc_ka(BinaryOpUGen *unit, int inNumSamples)
5103 float *out = ZOUT(0);
5104 float xa = unit->mPrevA;
5105 float *b = ZIN(1);
5106 float next_a = ZIN0(0);
5108 if (xa == next_a) {
5109 LOOP1(inNumSamples,
5110 float xb = ZXP(b);
5111 ZXP(out) = sc_trunc(xa, xb);
5113 } else {
5114 float slope = CALCSLOPE(next_a, xa);
5115 LOOP1(inNumSamples,
5116 float xb = ZXP(b);
5117 ZXP(out) = sc_trunc(xa, xb);
5118 xa += slope;
5120 unit->mPrevA = xa;
5124 void trunc_ia(BinaryOpUGen *unit, int inNumSamples)
5126 float *out = ZOUT(0);
5127 float xa = ZIN0(0);
5128 float *b = ZIN(1);
5130 LOOP1(inNumSamples,
5131 float xb = ZXP(b);
5132 ZXP(out) = sc_trunc(xa, xb);
5134 unit->mPrevA = xa;
5138 void trunc_ai(BinaryOpUGen *unit, int inNumSamples)
5140 float *out = ZOUT(0);
5141 float *a = ZIN(0);
5142 float xb = ZIN0(1);
5144 LOOP1(inNumSamples,
5145 float xa = ZXP(a);
5146 ZXP(out) = sc_trunc(xa, xb);
5148 unit->mPrevB = xb;
5153 void fold2_aa(BinaryOpUGen *unit, int inNumSamples)
5155 float *out = ZOUT(0);
5156 float *a = ZIN(0);
5157 float *b = ZIN(1);
5159 LOOP1(inNumSamples,
5160 float xa = ZXP(a);
5161 float xb = ZXP(b);
5162 ZXP(out) = sc_fold(xa, -xb, xb);
5166 void fold2_ak(BinaryOpUGen *unit, int inNumSamples)
5168 float *out = ZOUT(0);
5169 float *a = ZIN(0);
5170 float xb = unit->mPrevB;
5171 float next_b = ZIN0(1);
5173 if (xb == next_b) {
5174 LOOP1(inNumSamples,
5175 float xa = ZXP(a);
5176 ZXP(out) = sc_fold(xa, -xb, xb);
5178 } else {
5179 float slope = CALCSLOPE(next_b, xb);
5180 LOOP1(inNumSamples,
5181 float xa = ZXP(a);
5182 ZXP(out) = sc_fold(xa, -xb, xb);
5183 xb += slope;
5185 unit->mPrevB = xb;
5189 void fold2_ka(BinaryOpUGen *unit, int inNumSamples)
5191 float *out = ZOUT(0);
5192 float xa = unit->mPrevA;
5193 float *b = ZIN(1);
5194 float next_a = ZIN0(0);
5196 if (xa == next_a) {
5197 LOOP1(inNumSamples,
5198 float xb = ZXP(b);
5199 ZXP(out) = sc_fold(xa, -xb, xb);
5201 } else {
5202 float slope = CALCSLOPE(next_a, xa);
5203 LOOP1(inNumSamples,
5204 float xb = ZXP(b);
5205 ZXP(out) = sc_fold(xa, -xb, xb);
5206 xa += slope;
5208 unit->mPrevA = xa;
5212 void fold2_ia(BinaryOpUGen *unit, int inNumSamples)
5214 float *out = ZOUT(0);
5215 float xa = ZIN0(0);
5216 float *b = ZIN(1);
5218 LOOP1(inNumSamples,
5219 float xb = ZXP(b);
5220 ZXP(out) = sc_fold(xa, -xb, xb);
5222 unit->mPrevA = xa;
5226 void fold2_ai(BinaryOpUGen *unit, int inNumSamples)
5228 float *out = ZOUT(0);
5229 float *a = ZIN(0);
5230 float xb = ZIN0(1);
5232 LOOP1(inNumSamples,
5233 float xa = ZXP(a);
5234 ZXP(out) = sc_fold(xa, -xb, xb);
5236 unit->mPrevB = xb;
5242 void wrap2_aa(BinaryOpUGen *unit, int inNumSamples)
5244 float *out = ZOUT(0);
5245 float *a = ZIN(0);
5246 float *b = ZIN(1);
5248 LOOP1(inNumSamples,
5249 float xa = ZXP(a);
5250 float xb = ZXP(b);
5251 ZXP(out) = sc_wrap(xa, -xb, xb);
5255 void wrap2_ak(BinaryOpUGen *unit, int inNumSamples)
5257 float *out = ZOUT(0);
5258 float *a = ZIN(0);
5259 float xb = unit->mPrevB;
5260 float next_b = ZIN0(1);
5262 if (xb == next_b) {
5263 LOOP1(inNumSamples,
5264 float xa = ZXP(a);
5265 ZXP(out) = sc_wrap(xa, -xb, xb);
5267 } else {
5268 float slope = CALCSLOPE(next_b, xb);
5269 LOOP1(inNumSamples,
5270 float xa = ZXP(a);
5271 ZXP(out) = sc_wrap(xa, -xb, xb);
5272 xb += slope;
5274 unit->mPrevB = xb;
5278 void wrap2_ka(BinaryOpUGen *unit, int inNumSamples)
5280 float *out = ZOUT(0);
5281 float xa = unit->mPrevA;
5282 float *b = ZIN(1);
5283 float next_a = ZIN0(0);
5285 if (xa == next_a) {
5286 LOOP1(inNumSamples,
5287 float xb = ZXP(b);
5288 ZXP(out) = sc_wrap(xa, -xb, xb);
5290 } else {
5291 float slope = CALCSLOPE(next_a, xa);
5292 LOOP1(inNumSamples,
5293 float xb = ZXP(b);
5294 ZXP(out) = sc_wrap(xa, -xb, xb);
5295 xa += slope;
5297 unit->mPrevA = xa;
5301 void wrap2_ia(BinaryOpUGen *unit, int inNumSamples)
5303 float *out = ZOUT(0);
5304 float xa = ZIN0(0);
5305 float *b = ZIN(1);
5307 LOOP1(inNumSamples,
5308 float xb = ZXP(b);
5309 ZXP(out) = sc_wrap(xa, -xb, xb);
5311 unit->mPrevA = xa;
5315 void wrap2_ai(BinaryOpUGen *unit, int inNumSamples)
5317 float *out = ZOUT(0);
5318 float *a = ZIN(0);
5319 float xb = ZIN0(1);
5321 LOOP1(inNumSamples,
5322 float xa = ZXP(a);
5323 ZXP(out) = sc_wrap(xa, -xb, xb);
5325 unit->mPrevB = xb;
5330 void atan2_aa(BinaryOpUGen *unit, int inNumSamples)
5332 float *out = ZOUT(0);
5333 float *a = ZIN(0);
5334 float *b = ZIN(1);
5336 LOOP1(inNumSamples,
5337 float xa = ZXP(a);
5338 float xb = ZXP(b);
5339 ZXP(out) = atan2(xa, xb);
5343 void atan2_ak(BinaryOpUGen *unit, int inNumSamples)
5345 float *out = ZOUT(0);
5346 float *a = ZIN(0);
5347 float xb = unit->mPrevB;
5348 float next_b = ZIN0(1);
5350 if (xb == next_b) {
5351 LOOP1(inNumSamples,
5352 float xa = ZXP(a);
5353 ZXP(out) = atan2(xa, xb);
5355 } else {
5356 float slope = CALCSLOPE(next_b, xb);
5357 LOOP1(inNumSamples,
5358 float xa = ZXP(a);
5359 ZXP(out) = atan2(xa, xb);
5360 xb += slope;
5362 unit->mPrevB = xb;
5366 void atan2_ka(BinaryOpUGen *unit, int inNumSamples)
5368 float *out = ZOUT(0);
5369 float xa = unit->mPrevA;
5370 float *b = ZIN(1);
5371 float next_a = ZIN0(0);
5373 if (xa == next_a) {
5374 LOOP1(inNumSamples,
5375 float xb = ZXP(b);
5376 ZXP(out) = atan2(xa, xb);
5378 } else {
5379 float slope = CALCSLOPE(next_a, xa);
5380 LOOP1(inNumSamples,
5381 float xb = ZXP(b);
5382 ZXP(out) = atan2(xa, xb);
5383 xa += slope;
5385 unit->mPrevA = xa;
5389 void atan2_ia(BinaryOpUGen *unit, int inNumSamples)
5391 float *out = ZOUT(0);
5392 float xa = ZIN0(0);
5393 float *b = ZIN(1);
5395 LOOP1(inNumSamples,
5396 float xb = ZXP(b);
5397 ZXP(out) = atan2(xa, xb);
5399 unit->mPrevA = xa;
5403 void atan2_ai(BinaryOpUGen *unit, int inNumSamples)
5405 float *out = ZOUT(0);
5406 float *a = ZIN(0);
5407 float xb = ZIN0(1);
5409 LOOP1(inNumSamples,
5410 float xa = ZXP(a);
5411 ZXP(out) = atan2(xa, xb);
5413 unit->mPrevB = xb;
5417 void hypot_aa(BinaryOpUGen *unit, int inNumSamples)
5419 float *out = ZOUT(0);
5420 float *a = ZIN(0);
5421 float *b = ZIN(1);
5423 LOOP1(inNumSamples,
5424 float xa = ZXP(a);
5425 float xb = ZXP(b);
5426 ZXP(out) = hypotf(xa, xb);
5430 void hypot_ak(BinaryOpUGen *unit, int inNumSamples)
5432 float *out = ZOUT(0);
5433 float *a = ZIN(0);
5434 float xb = unit->mPrevB;
5435 float next_b = ZIN0(1);
5437 if (xb == next_b) {
5438 LOOP1(inNumSamples,
5439 float xa = ZXP(a);
5440 ZXP(out) = hypotf(xa, xb);
5442 } else {
5443 float slope = CALCSLOPE(next_b, xb);
5444 LOOP1(inNumSamples,
5445 float xa = ZXP(a);
5446 ZXP(out) = hypotf(xa, xb);
5447 xb += slope;
5449 unit->mPrevB = xb;
5453 void hypot_ka(BinaryOpUGen *unit, int inNumSamples)
5455 float *out = ZOUT(0);
5456 float xa = unit->mPrevA;
5457 float *b = ZIN(1);
5458 float next_a = ZIN0(0);
5460 if (xa == next_a) {
5461 LOOP1(inNumSamples,
5462 float xb = ZXP(b);
5463 ZXP(out) = hypotf(xa, xb);
5465 } else {
5466 float slope = CALCSLOPE(next_a, xa);
5467 LOOP1(inNumSamples,
5468 float xb = ZXP(b);
5469 ZXP(out) = hypotf(xa, xb);
5470 xa += slope;
5472 unit->mPrevA = xa;
5476 void hypot_ia(BinaryOpUGen *unit, int inNumSamples)
5478 float *out = ZOUT(0);
5479 float xa = ZIN0(0);
5480 float *b = ZIN(1);
5482 LOOP1(inNumSamples,
5483 float xb = ZXP(b);
5484 ZXP(out) = hypotf(xa, xb);
5486 unit->mPrevA = xa;
5490 void hypot_ai(BinaryOpUGen *unit, int inNumSamples)
5492 float *out = ZOUT(0);
5493 float *a = ZIN(0);
5494 float xb = ZIN0(1);
5496 LOOP1(inNumSamples,
5497 float xa = ZXP(a);
5498 ZXP(out) = hypotf(xa, xb);
5500 unit->mPrevB = xb;
5505 void hypotx_aa(BinaryOpUGen *unit, int inNumSamples)
5507 float *out = ZOUT(0);
5508 float *a = ZIN(0);
5509 float *b = ZIN(1);
5511 LOOP1(inNumSamples,
5512 float xa = ZXP(a);
5513 float xb = ZXP(b);
5514 ZXP(out) = sc_hypotx(xa, xb);
5518 void hypotx_ak(BinaryOpUGen *unit, int inNumSamples)
5520 float *out = ZOUT(0);
5521 float *a = ZIN(0);
5522 float xb = unit->mPrevB;
5523 float next_b = ZIN0(1);
5525 if (xb == next_b) {
5526 LOOP1(inNumSamples,
5527 float xa = ZXP(a);
5528 ZXP(out) = sc_hypotx(xa, xb);
5530 } else {
5531 float slope = CALCSLOPE(next_b, xb);
5532 LOOP1(inNumSamples,
5533 float xa = ZXP(a);
5534 ZXP(out) = sc_hypotx(xa, xb);
5535 xb += slope;
5537 unit->mPrevB = xb;
5541 void hypotx_ka(BinaryOpUGen *unit, int inNumSamples)
5543 float *out = ZOUT(0);
5544 float xa = unit->mPrevA;
5545 float *b = ZIN(1);
5546 float next_a = ZIN0(0);
5548 if (xa == next_a) {
5549 LOOP1(inNumSamples,
5550 float xb = ZXP(b);
5551 ZXP(out) = sc_hypotx(xa, xb);
5553 } else {
5554 float slope = CALCSLOPE(next_a, xa);
5555 LOOP1(inNumSamples,
5556 float xb = ZXP(b);
5557 ZXP(out) = sc_hypotx(xa, xb);
5558 xa += slope;
5560 unit->mPrevA = xa;
5564 void hypotx_ia(BinaryOpUGen *unit, int inNumSamples)
5566 float *out = ZOUT(0);
5567 float xa = ZIN0(0);
5568 float *b = ZIN(1);
5570 LOOP1(inNumSamples,
5571 float xb = ZXP(b);
5572 ZXP(out) = sc_hypotx(xa, xb);
5574 unit->mPrevA = xa;
5578 void hypotx_ai(BinaryOpUGen *unit, int inNumSamples)
5580 float *out = ZOUT(0);
5581 float *a = ZIN(0);
5582 float xb = ZIN0(1);
5584 LOOP1(inNumSamples,
5585 float xa = ZXP(a);
5586 ZXP(out) = sc_hypotx(xa, xb);
5588 unit->mPrevB = xb;
5591 static BinaryOpFunc ChooseOneSampleFunc(BinaryOpUGen *unit)
5593 BinaryOpFunc func = &zero_1;
5595 switch (unit->mSpecialIndex) {
5596 //case opSilence2 : func = &zero_1; break;
5597 case opAdd : func = &add_1; break;
5598 case opSub : func = &sub_1; break;
5599 case opMul : func = &mul_1; break;
5600 case opFDiv : func = &div_1; break;
5601 case opMod : func = &mod_1; break;
5602 case opEQ : func = &eq_1; break;
5603 case opNE : func = &neq_1; break;
5604 case opLT : func = &lt_1; break;
5605 case opGT : func = &gt_1; break;
5606 case opLE : func = &le_1; break;
5607 case opGE : func = &ge_1; break;
5608 case opMin : func = &min_1; break;
5609 case opMax : func = &max_1; break;
5610 case opBitAnd : func = &and_1; break;
5611 case opBitOr : func = &or_1; break;
5612 case opBitXor : func = &xor_1; break;
5613 case opShiftRight : func = &rightShift_1; break;
5614 case opShiftLeft : func = &leftShift_1; break;
5615 case opRound : func = &round_1; break;
5616 case opRoundUp : func = &roundUp_1; break;
5617 case opTrunc : func = &trunc_1; break;
5618 case opAtan2 : func = &atan2_1; break;
5619 case opHypot : func = &hypot_1; break;
5620 case opHypotx : func = &hypotx_1; break;
5621 case opPow : func = &pow_1; break;
5622 case opRing1 : func = &ring1_1; break;
5623 case opRing2 : func = &ring2_1; break;
5624 case opRing3 : func = &ring3_1; break;
5625 case opRing4 : func = &ring4_1; break;
5626 case opDifSqr : func = &difsqr_1; break;
5627 case opSumSqr : func = &sumsqr_1; break;
5628 case opSqrSum : func = &sqrsum_1; break;
5629 case opSqrDif : func = &sqrdif_1; break;
5630 case opAbsDif : func = &absdif_1; break;
5631 case opThresh : func = &thresh_1; break;
5632 case opAMClip : func = &amclip_1; break;
5633 case opScaleNeg : func = &scaleneg_1; break;
5634 case opClip2 : func = &clip2_1; break;
5635 case opFold2 : func = &fold2_1; break;
5636 case opWrap2 : func = &wrap2_1; break;
5637 case opExcess : func = &excess_1; break;
5638 case opFirstArg : func = &firstarg_1; break;
5639 //case opSecondArg : func = &secondarg_1; break;
5640 default : func = &add_1; break;
5642 return func;
5646 static BinaryOpFunc ChooseDemandFunc(BinaryOpUGen *unit)
5648 BinaryOpFunc func = &zero_1;
5650 switch (unit->mSpecialIndex) {
5651 //case opSilence2 : func = &zero_d; break;
5652 case opAdd : func = &add_d; break;
5653 case opSub : func = &sub_d; break;
5654 case opMul : func = &mul_d; break;
5655 case opFDiv : func = &div_d; break;
5656 case opMod : func = &mod_d; break;
5657 case opEQ : func = &eq_d; break;
5658 case opNE : func = &neq_d; break;
5659 case opLT : func = &lt_d; break;
5660 case opGT : func = &gt_d; break;
5661 case opLE : func = &le_d; break;
5662 case opGE : func = &ge_d; break;
5663 case opMin : func = &min_d; break;
5664 case opMax : func = &max_d; break;
5665 case opBitAnd : func = &and_d; break;
5666 case opBitOr : func = &or_d; break;
5667 case opBitXor : func = &xor_d; break;
5668 case opShiftRight : func = &rightShift_d; break;
5669 case opShiftLeft : func = &leftShift_d; break;
5670 case opRound : func = &round_d; break;
5671 case opRoundUp : func = &roundUp_d; break;
5672 case opTrunc : func = &trunc_d; break;
5673 case opAtan2 : func = &atan2_d; break;
5674 case opHypot : func = &hypot_d; break;
5675 case opHypotx : func = &hypotx_d; break;
5676 case opPow : func = &pow_d; break;
5677 case opRing1 : func = &ring1_d; break;
5678 case opRing2 : func = &ring2_d; break;
5679 case opRing3 : func = &ring3_d; break;
5680 case opRing4 : func = &ring4_d; break;
5681 case opDifSqr : func = &difsqr_d; break;
5682 case opSumSqr : func = &sumsqr_d; break;
5683 case opSqrSum : func = &sqrsum_d; break;
5684 case opSqrDif : func = &sqrdif_d; break;
5685 case opAbsDif : func = &absdif_d; break;
5686 case opThresh : func = &thresh_d; break;
5687 case opAMClip : func = &amclip_d; break;
5688 case opScaleNeg : func = &scaleneg_d; break;
5689 case opClip2 : func = &clip2_d; break;
5690 case opFold2 : func = &fold2_d; break;
5691 case opWrap2 : func = &wrap2_d; break;
5692 case opExcess : func = &excess_d; break;
5693 case opFirstArg : func = &firstarg_d; break;
5694 //case opSecondArg : func = &secondarg_d; break;
5695 default : func = &add_d; break;
5697 return func;
5701 static BinaryOpFunc ChooseNormalFunc(BinaryOpUGen *unit)
5703 BinaryOpFunc func = &zero_1;
5705 int rateA = INRATE(0);
5706 int rateB = INRATE(1);
5708 switch (rateA) {
5709 case calc_FullRate:
5710 switch (rateB) {
5711 case calc_FullRate:
5712 switch (unit->mSpecialIndex) {
5713 //case opSilence2 : func = &zero_aa; break;
5714 case opAdd : func = &add_aa; break;
5715 case opSub : func = &sub_aa; break;
5716 case opMul : func = &mul_aa; break;
5717 case opFDiv : func = &div_aa; break;
5718 case opMod : func = &mod_aa; break;
5719 case opEQ : func = &eq_aa; break;
5720 case opNE : func = &neq_aa; break;
5721 case opLT : func = &lt_aa; break;
5722 case opGT : func = &gt_aa; break;
5723 case opLE : func = &le_aa; break;
5724 case opGE : func = &ge_aa; break;
5725 case opMin : func = &min_aa; break;
5726 case opMax : func = &max_aa; break;
5727 case opBitAnd : func = &and_aa; break;
5728 case opBitOr : func = &or_aa; break;
5729 case opBitXor : func = &xor_aa; break;
5730 case opShiftRight : func = &rightShift_aa; break;
5731 case opShiftLeft : func = &leftShift_aa; break;
5732 case opRound : func = &round_aa; break;
5733 case opRoundUp : func = &roundUp_aa; break;
5734 case opTrunc : func = &trunc_aa; break;
5735 case opAtan2 : func = &atan2_aa; break;
5736 case opHypot : func = &hypot_aa; break;
5737 case opHypotx : func = &hypotx_aa; break;
5738 case opPow : func = &pow_aa; break;
5739 case opRing1 : func = &ring1_aa; break;
5740 case opRing2 : func = &ring2_aa; break;
5741 case opRing3 : func = &ring3_aa; break;
5742 case opRing4 : func = &ring4_aa; break;
5743 case opDifSqr : func = &difsqr_aa; break;
5744 case opSumSqr : func = &sumsqr_aa; break;
5745 case opSqrSum : func = &sqrsum_aa; break;
5746 case opSqrDif : func = &sqrdif_aa; break;
5747 case opAbsDif : func = &absdif_aa; break;
5748 case opThresh : func = &thresh_aa; break;
5749 case opAMClip : func = &amclip_aa; break;
5750 case opScaleNeg : func = &scaleneg_aa; break;
5751 case opClip2 : func = &clip2_aa; break;
5752 case opFold2 : func = &fold2_aa; break;
5753 case opWrap2 : func = &wrap2_aa; break;
5754 case opExcess : func = &excess_aa; break;
5755 case opFirstArg : func = &firstarg_aa; break;
5756 //case opSecondArg : func = &secondarg_aa; break;
5757 default : func = &add_aa; break;
5759 break;
5760 case calc_BufRate :
5761 switch (unit->mSpecialIndex) {
5762 //case opSilence2 : func = &zero_aa; break;
5763 case opAdd : func = &add_ak; break;
5764 case opSub : func = &sub_ak; break;
5765 case opMul : func = &mul_ak; break;
5766 case opFDiv : func = &div_ak; break;
5767 case opMod : func = &mod_ak; break;
5768 case opEQ : func = &eq_ak; break;
5769 case opNE : func = &neq_ak; break;
5770 case opLT : func = &lt_ak; break;
5771 case opGT : func = &gt_ak; break;
5772 case opLE : func = &le_ak; break;
5773 case opGE : func = &ge_ak; break;
5774 case opMin : func = &min_ak; break;
5775 case opMax : func = &max_ak; break;
5776 case opBitAnd : func = &and_ak; break;
5777 case opBitOr : func = &or_ak; break;
5778 case opBitXor : func = &xor_ak; break;
5779 case opShiftRight : func = &rightShift_ak; break;
5780 case opShiftLeft : func = &leftShift_ak; break;
5781 case opRound : func = &round_ak; break;
5782 case opRoundUp : func = &roundUp_ak; break;
5783 case opTrunc : func = &trunc_ak; break;
5784 case opAtan2 : func = &atan2_ak; break;
5785 case opHypot : func = &hypot_ak; break;
5786 case opHypotx : func = &hypotx_ak; break;
5787 case opPow : func = &pow_ak; break;
5788 case opRing1 : func = &ring1_ak; break;
5789 case opRing2 : func = &ring2_ak; break;
5790 case opRing3 : func = &ring3_ak; break;
5791 case opRing4 : func = &ring4_ak; break;
5792 case opDifSqr : func = &difsqr_ak; break;
5793 case opSumSqr : func = &sumsqr_ak; break;
5794 case opSqrSum : func = &sqrsum_ak; break;
5795 case opSqrDif : func = &sqrdif_ak; break;
5796 case opAbsDif : func = &absdif_ak; break;
5797 case opThresh : func = &thresh_ak; break;
5798 case opAMClip : func = &amclip_ak; break;
5799 case opScaleNeg : func = &scaleneg_ak; break;
5800 case opClip2 : func = &clip2_ak; break;
5801 case opFold2 : func = &fold2_ak; break;
5802 case opWrap2 : func = &wrap2_ak; break;
5803 case opExcess : func = &excess_ak; break;
5804 case opFirstArg : func = &firstarg_aa; break;
5805 //case opSecondArg : func = &secondarg_aa; break;
5806 default : func = &add_ak; break;
5808 break;
5809 case calc_ScalarRate :
5810 switch (unit->mSpecialIndex) {
5811 //case opSilence2 : func = &zero_aa; break;
5812 case opAdd : func = &add_ai; break;
5813 case opSub : func = &sub_ai; break;
5814 case opMul : func = &mul_ai; break;
5815 case opFDiv : func = &div_ai; break;
5816 case opMod : func = &mod_ai; break;
5817 case opEQ : func = &eq_ai; break;
5818 case opNE : func = &neq_ai; break;
5819 case opLT : func = &lt_ai; break;
5820 case opGT : func = &gt_ai; break;
5821 case opLE : func = &le_ai; break;
5822 case opGE : func = &ge_ai; break;
5823 case opMin : func = &min_ai; break;
5824 case opMax : func = &max_ai; break;
5825 case opBitAnd : func = &and_ai; break;
5826 case opBitOr : func = &or_ai; break;
5827 case opBitXor : func = &xor_ai; break;
5828 case opShiftRight : func = &rightShift_ai; break;
5829 case opShiftLeft : func = &leftShift_ai; break;
5830 case opRound : func = &round_ai; break;
5831 case opRoundUp : func = &roundUp_ai; break;
5832 case opTrunc : func = &trunc_ai; break;
5833 case opAtan2 : func = &atan2_ai; break;
5834 case opHypot : func = &hypot_ai; break;
5835 case opHypotx : func = &hypotx_ai; break;
5836 case opPow : func = &pow_ai; break;
5837 case opRing1 : func = &ring1_ai; break;
5838 case opRing2 : func = &ring2_ai; break;
5839 case opRing3 : func = &ring3_ai; break;
5840 case opRing4 : func = &ring4_ai; break;
5841 case opDifSqr : func = &difsqr_ai; break;
5842 case opSumSqr : func = &sumsqr_ai; break;
5843 case opSqrSum : func = &sqrsum_ai; break;
5844 case opSqrDif : func = &sqrdif_ai; break;
5845 case opAbsDif : func = &absdif_ai; break;
5846 case opThresh : func = &thresh_ai; break;
5847 case opAMClip : func = &amclip_ai; break;
5848 case opScaleNeg : func = &scaleneg_ai; break;
5849 case opClip2 : func = &clip2_ai; break;
5850 case opFold2 : func = &fold2_ai; break;
5851 case opWrap2 : func = &wrap2_ai; break;
5852 case opExcess : func = &excess_ai; break;
5853 case opFirstArg : func = &firstarg_aa; break;
5854 //case opSecondArg : func = &secondarg_aa; break;
5855 default : func = &add_ai; break;
5858 break;
5859 case calc_BufRate :
5860 if (rateB == calc_FullRate) {
5861 switch (unit->mSpecialIndex) {
5862 //case opSilence2 : func = &zero_aa; break;
5863 case opAdd : func = &add_ka; break;
5864 case opSub : func = &sub_ka; break;
5865 case opMul : func = &mul_ka; break;
5866 case opFDiv : func = &div_ka; break;
5867 case opMod : func = &mod_ka; break;
5868 case opEQ : func = &eq_ka; break;
5869 case opNE : func = &neq_ka; break;
5870 case opLT : func = &lt_ka; break;
5871 case opGT : func = &gt_ka; break;
5872 case opLE : func = &le_ka; break;
5873 case opGE : func = &ge_ka; break;
5874 case opMin : func = &min_ka; break;
5875 case opMax : func = &max_ka; break;
5876 case opBitAnd : func = &and_ka; break;
5877 case opBitOr : func = &or_ka; break;
5878 case opBitXor : func = &xor_ka; break;
5879 case opShiftRight : func = &rightShift_ka; break;
5880 case opShiftLeft : func = &leftShift_ka; break;
5881 case opRound : func = &round_ka; break;
5882 case opRoundUp : func = &roundUp_ka; break;
5883 case opTrunc : func = &trunc_ka; break;
5884 case opAtan2 : func = &atan2_ka; break;
5885 case opHypot : func = &hypot_ka; break;
5886 case opHypotx : func = &hypotx_ka; break;
5887 case opPow : func = &pow_ka; break;
5888 case opRing1 : func = &ring1_ka; break;
5889 case opRing2 : func = &ring2_ka; break;
5890 case opRing3 : func = &ring3_ka; break;
5891 case opRing4 : func = &ring4_ka; break;
5892 case opDifSqr : func = &difsqr_ka; break;
5893 case opSumSqr : func = &sumsqr_ka; break;
5894 case opSqrSum : func = &sqrsum_ka; break;
5895 case opSqrDif : func = &sqrdif_ka; break;
5896 case opAbsDif : func = &absdif_ka; break;
5897 case opThresh : func = &thresh_ka; break;
5898 case opAMClip : func = &amclip_ka; break;
5899 case opScaleNeg : func = &scaleneg_ka; break;
5900 case opClip2 : func = &clip2_ka; break;
5901 case opFold2 : func = &fold2_ka; break;
5902 case opWrap2 : func = &wrap2_ka; break;
5903 case opExcess : func = &excess_ka; break;
5904 //case opFirstArg : func = &firstarg_aa; break;
5905 //case opSecondArg : func = &secondarg_aa; break;
5906 default : func = &add_ka; break;
5908 } else {
5909 // this should have been caught by mBufLength == 1
5910 func = &zero_aa;
5912 break;
5913 case calc_ScalarRate :
5914 if (rateB == calc_FullRate) {
5915 switch (unit->mSpecialIndex) {
5916 //case opSilence2 : func = &zero_aa; break;
5917 case opAdd : func = &add_ia; break;
5918 case opSub : func = &sub_ia; break;
5919 case opMul : func = &mul_ia; break;
5920 case opFDiv : func = &div_ia; break;
5921 case opMod : func = &mod_ia; break;
5922 case opEQ : func = &eq_ia; break;
5923 case opNE : func = &neq_ia; break;
5924 case opLT : func = &lt_ia; break;
5925 case opGT : func = &gt_ia; break;
5926 case opLE : func = &le_ia; break;
5927 case opGE : func = &ge_ia; break;
5928 case opMin : func = &min_ia; break;
5929 case opMax : func = &max_ia; break;
5930 case opBitAnd : func = &and_ia; break;
5931 case opBitOr : func = &or_ia; break;
5932 case opBitXor : func = &xor_ia; break;
5933 case opShiftRight : func = &rightShift_ia; break;
5934 case opShiftLeft : func = &leftShift_ia; break;
5935 case opRound : func = &round_ia; break;
5936 case opRoundUp : func = &roundUp_ia; break;
5937 case opTrunc : func = &trunc_ia; break;
5938 case opAtan2 : func = &atan2_ia; break;
5939 case opHypot : func = &hypot_ia; break;
5940 case opHypotx : func = &hypotx_ia; break;
5941 case opPow : func = &pow_ia; break;
5942 case opRing1 : func = &ring1_ia; break;
5943 case opRing2 : func = &ring2_ia; break;
5944 case opRing3 : func = &ring3_ia; break;
5945 case opRing4 : func = &ring4_ia; break;
5946 case opDifSqr : func = &difsqr_ia; break;
5947 case opSumSqr : func = &sumsqr_ia; break;
5948 case opSqrSum : func = &sqrsum_ia; break;
5949 case opSqrDif : func = &sqrdif_ia; break;
5950 case opAbsDif : func = &absdif_ia; break;
5951 case opThresh : func = &thresh_ia; break;
5952 case opAMClip : func = &amclip_ia; break;
5953 case opScaleNeg : func = &scaleneg_ia; break;
5954 case opClip2 : func = &clip2_ia; break;
5955 case opFold2 : func = &fold2_ia; break;
5956 case opWrap2 : func = &wrap2_ia; break;
5957 case opExcess : func = &excess_ia; break;
5958 //case opFirstArg : func = &firstarg_aa; break;
5959 //case opSecondArg : func = &secondarg_aa; break;
5960 default : func = &add_ia; break;
5962 } else {
5963 // this should have been caught by mBufLength == 1
5964 func = &zero_aa;
5966 break;
5969 return func;
5972 #ifdef NOVA_SIMD
5973 static BinaryOpFunc ChooseNovaSimdFunc_64(BinaryOpUGen *unit)
5975 BinaryOpFunc func = &zero_1;
5977 int rateA = INRATE(0);
5978 int rateB = INRATE(1);
5980 switch (rateA) {
5981 case calc_FullRate:
5982 switch (rateB) {
5983 case calc_FullRate:
5984 switch (unit->mSpecialIndex) {
5985 //case opSilence2 : func = &zero_aa; break;
5986 case opAdd : func = &add_aa_nova_64; break;
5987 case opSub : func = &sub_aa_nova_64; break;
5988 case opMul : func = &mul_aa_nova_64; break;
5989 case opFDiv : func = &div_aa_nova; break;
5990 case opMod : func = &mod_aa; break;
5991 case opEQ : func = &eq_aa_nova_64; break;
5992 case opNE : func = &neq_aa_nova_64; break;
5993 case opLT : func = &lt_aa_nova_64; break;
5994 case opGT : func = &gt_aa_nova_64; break;
5995 case opLE : func = &le_aa_nova_64; break;
5996 case opGE : func = &ge_aa_nova_64; break;
5997 case opMin : func = &min_aa_nova_64; break;
5998 case opMax : func = &max_aa_nova_64; break;
5999 case opBitAnd : func = &and_aa; break;
6000 case opBitOr : func = &or_aa; break;
6001 case opBitXor : func = &xor_aa; break;
6002 case opShiftRight : func = &rightShift_aa; break;
6003 case opShiftLeft : func = &leftShift_aa; break;
6004 case opRound : func = &round_aa; break;
6005 case opRoundUp : func = &roundUp_aa; break;
6006 case opTrunc : func = &trunc_aa; break;
6007 case opAtan2 : func = &atan2_aa; break;
6008 case opHypot : func = &hypot_aa; break;
6009 case opHypotx : func = &hypotx_aa; break;
6010 case opPow : func = &pow_aa_nova; break;
6011 case opRing1 : func = &ring1_aa; break;
6012 case opRing2 : func = &ring2_aa; break;
6013 case opRing3 : func = &ring3_aa; break;
6014 case opRing4 : func = &ring4_aa; break;
6015 case opDifSqr : func = &difsqr_aa; break;
6016 case opSumSqr : func = &sumsqr_aa; break;
6017 case opSqrSum : func = &sqrsum_aa; break;
6018 case opSqrDif : func = &sqrdif_aa; break;
6019 case opAbsDif : func = &absdif_aa; break;
6020 case opThresh : func = &thresh_aa; break;
6021 case opAMClip : func = &amclip_aa; break;
6022 case opScaleNeg : func = &scaleneg_aa; break;
6023 case opClip2 : func = &clip2_aa_nova_64; break;
6024 case opFold2 : func = &fold2_aa; break;
6025 case opWrap2 : func = &wrap2_aa; break;
6026 case opExcess : func = &excess_aa; break;
6027 case opFirstArg : func = &firstarg_aa_nova; break;
6028 //case opSecondArg : func = &secondarg_aa_nova; break;
6029 default : func = &add_aa; break;
6031 break;
6032 case calc_BufRate :
6033 switch (unit->mSpecialIndex) {
6034 //case opSilence2 : func = &zero_aa; break;
6035 case opAdd : func = &add_ak_nova_64; break;
6036 case opSub : func = &sub_ak_nova_64; break;
6037 case opMul : func = &mul_ak_nova_64; break;
6038 case opFDiv : func = &div_ak_nova; break;
6039 case opMod : func = &mod_ak; break;
6040 case opEQ : func = &eq_ak_nova_64; break;
6041 case opNE : func = &neq_ak_nova_64; break;
6042 case opLT : func = &lt_ak_nova_64; break;
6043 case opGT : func = &gt_ak_nova_64; break;
6044 case opLE : func = &le_ak_nova_64; break;
6045 case opGE : func = &ge_ak_nova_64; break;
6046 case opMin : func = &min_ak_nova_64; break;
6047 case opMax : func = &max_ak_nova_64; break;
6048 case opBitAnd : func = &and_ak; break;
6049 case opBitOr : func = &or_ak; break;
6050 case opBitXor : func = &xor_ak; break;
6051 case opShiftRight : func = &rightShift_ak; break;
6052 case opShiftLeft : func = &leftShift_ak; break;
6053 case opRound : func = &round_ak; break;
6054 case opRoundUp : func = &roundUp_ak; break;
6055 case opTrunc : func = &trunc_ak; break;
6056 case opAtan2 : func = &atan2_ak; break;
6057 case opHypot : func = &hypot_ak; break;
6058 case opHypotx : func = &hypotx_ak; break;
6059 case opPow : func = &pow_ak_nova; break;
6060 case opRing1 : func = &ring1_ak; break;
6061 case opRing2 : func = &ring2_ak; break;
6062 case opRing3 : func = &ring3_ak; break;
6063 case opRing4 : func = &ring4_ak; break;
6064 case opDifSqr : func = &difsqr_ak; break;
6065 case opSumSqr : func = &sumsqr_ak; break;
6066 case opSqrSum : func = &sqrsum_ak; break;
6067 case opSqrDif : func = &sqrdif_ak; break;
6068 case opAbsDif : func = &absdif_ak; break;
6069 case opThresh : func = &thresh_ak; break;
6070 case opAMClip : func = &amclip_ak; break;
6071 case opScaleNeg : func = &scaleneg_ak; break;
6072 case opClip2 : func = &clip2_ak_nova_64; break;
6073 case opFold2 : func = &fold2_ak; break;
6074 case opWrap2 : func = &wrap2_ak; break;
6075 case opExcess : func = &excess_ak; break;
6076 case opFirstArg : func = &firstarg_aa; break;
6077 //case opSecondArg : func = &secondarg_aa; break;
6078 default : func = &add_ak; break;
6080 break;
6081 case calc_ScalarRate :
6082 switch (unit->mSpecialIndex) {
6083 //case opSilence2 : func = &zero_aa; break;
6084 case opAdd : func = &add_ai_nova_64; break;
6085 case opSub : func = &sub_ai_nova_64; break;
6086 case opMul : func = &mul_ai_nova_64; break;
6087 case opFDiv : func = &div_ai_nova; break;
6088 case opMod : func = &mod_ai; break;
6089 case opEQ : func = &eq_ai_nova_64; break;
6090 case opNE : func = &neq_ai_nova_64; break;
6091 case opLT : func = &lt_ai_nova_64; break;
6092 case opGT : func = &gt_ai_nova_64; break;
6093 case opLE : func = &le_ai_nova_64; break;
6094 case opGE : func = &ge_ai_nova_64; break;
6095 case opMin : func = &min_ai_nova_64; break;
6096 case opMax : func = &max_ai_nova_64; break;
6097 case opBitAnd : func = &and_ai; break;
6098 case opBitOr : func = &or_ai; break;
6099 case opBitXor : func = &xor_ai; break;
6100 case opShiftRight : func = &rightShift_ai; break;
6101 case opShiftLeft : func = &leftShift_ai; break;
6102 case opRound : func = &round_ai; break;
6103 case opRoundUp : func = &roundUp_ai; break;
6104 case opTrunc : func = &trunc_ai; break;
6105 case opAtan2 : func = &atan2_ai; break;
6106 case opHypot : func = &hypot_ai; break;
6107 case opHypotx : func = &hypotx_ai; break;
6108 case opPow : func = &pow_ai_nova; break;
6109 case opRing1 : func = &ring1_ai; break;
6110 case opRing2 : func = &ring2_ai; break;
6111 case opRing3 : func = &ring3_ai; break;
6112 case opRing4 : func = &ring4_ai; break;
6113 case opDifSqr : func = &difsqr_ai; break;
6114 case opSumSqr : func = &sumsqr_ai; break;
6115 case opSqrSum : func = &sqrsum_ai; break;
6116 case opSqrDif : func = &sqrdif_ai; break;
6117 case opAbsDif : func = &absdif_ai; break;
6118 case opThresh : func = &thresh_ai; break;
6119 case opAMClip : func = &amclip_ai; break;
6120 case opScaleNeg : func = &scaleneg_ai; break;
6121 case opClip2 : func = &clip2_ai_nova_64; break;
6122 case opFold2 : func = &fold2_ai; break;
6123 case opWrap2 : func = &wrap2_ai; break;
6124 case opExcess : func = &excess_ai; break;
6125 case opFirstArg : func = &firstarg_aa; break;
6126 //case opSecondArg : func = &secondarg_aa; break;
6127 default : func = &add_ai; break;
6130 break;
6131 case calc_BufRate :
6132 if (rateB == calc_FullRate) {
6133 switch (unit->mSpecialIndex) {
6134 //case opSilence2 : func = &zero_aa; break;
6135 case opAdd : func = &add_ka_nova_64; break;
6136 case opSub : func = &sub_ka_nova_64; break;
6137 case opMul : func = &mul_ka_nova_64; break;
6138 case opFDiv : func = &div_ka_nova; break;
6139 case opMod : func = &mod_ka; break;
6140 case opEQ : func = &eq_ka_nova_64; break;
6141 case opNE : func = &neq_ka_nova_64; break;
6142 case opLT : func = &lt_ka_nova_64; break;
6143 case opGT : func = &gt_ka_nova_64; break;
6144 case opLE : func = &le_ka_nova_64; break;
6145 case opGE : func = &ge_ka_nova_64; break;
6146 case opMin : func = &min_ka_nova_64; break;
6147 case opMax : func = &max_ka_nova_64; break;
6148 case opBitAnd : func = &and_ka; break;
6149 case opBitOr : func = &or_ka; break;
6150 case opBitXor : func = &xor_ka; break;
6151 case opShiftRight : func = &rightShift_ka; break;
6152 case opShiftLeft : func = &leftShift_ka; break;
6153 case opRound : func = &round_ka; break;
6154 case opRoundUp : func = &roundUp_ka; break;
6155 case opTrunc : func = &trunc_ka; break;
6156 case opAtan2 : func = &atan2_ka; break;
6157 case opHypot : func = &hypot_ka; break;
6158 case opHypotx : func = &hypotx_ka; break;
6159 case opPow : func = &pow_ka_nova; break;
6160 case opRing1 : func = &ring1_ka; break;
6161 case opRing2 : func = &ring2_ka; break;
6162 case opRing3 : func = &ring3_ka; break;
6163 case opRing4 : func = &ring4_ka; break;
6164 case opDifSqr : func = &difsqr_ka; break;
6165 case opSumSqr : func = &sumsqr_ka; break;
6166 case opSqrSum : func = &sqrsum_ka; break;
6167 case opSqrDif : func = &sqrdif_ka; break;
6168 case opAbsDif : func = &absdif_ka; break;
6169 case opThresh : func = &thresh_ka; break;
6170 case opAMClip : func = &amclip_ka; break;
6171 case opScaleNeg : func = &scaleneg_ka; break;
6172 case opClip2 : func = &clip2_ka_nova_64; break;
6173 case opFold2 : func = &fold2_ka; break;
6174 case opWrap2 : func = &wrap2_ka; break;
6175 case opExcess : func = &excess_ka; break;
6176 //case opFirstArg : func = &firstarg_aa; break;
6177 //case opSecondArg : func = &secondarg_aa; break;
6178 default : func = &add_ka; break;
6180 } else {
6181 // this should have been caught by mBufLength == 1
6182 func = &zero_aa;
6184 break;
6185 case calc_ScalarRate :
6186 if (rateB == calc_FullRate) {
6187 switch (unit->mSpecialIndex) {
6188 //case opSilence2 : func = &zero_aa; break;
6189 case opAdd : func = &add_ia_nova_64; break;
6190 case opSub : func = &sub_ia_nova_64; break;
6191 case opMul : func = &mul_ia_nova_64; break;
6192 case opFDiv : func = &div_ia_nova; break;
6193 case opMod : func = &mod_ia; break;
6194 case opEQ : func = &eq_ia_nova_64; break;
6195 case opNE : func = &neq_ia_nova_64; break;
6196 case opLT : func = &lt_ia_nova_64; break;
6197 case opGT : func = &gt_ia_nova_64; break;
6198 case opLE : func = &le_ia_nova_64; break;
6199 case opGE : func = &ge_ia_nova_64; break;
6200 case opMin : func = &min_ia_nova_64; break;
6201 case opMax : func = &max_ia_nova_64; break;
6202 case opBitAnd : func = &and_ia; break;
6203 case opBitOr : func = &or_ia; break;
6204 case opBitXor : func = &xor_ia; break;
6205 case opShiftRight : func = &rightShift_ia; break;
6206 case opShiftLeft : func = &leftShift_ia; break;
6207 case opRound : func = &round_ia; break;
6208 case opRoundUp : func = &roundUp_ia; break;
6209 case opTrunc : func = &trunc_ia; break;
6210 case opAtan2 : func = &atan2_ia; break;
6211 case opHypot : func = &hypot_ia; break;
6212 case opHypotx : func = &hypotx_ia; break;
6213 case opPow : func = &pow_ia_nova; break;
6214 case opRing1 : func = &ring1_ia; break;
6215 case opRing2 : func = &ring2_ia; break;
6216 case opRing3 : func = &ring3_ia; break;
6217 case opRing4 : func = &ring4_ia; break;
6218 case opDifSqr : func = &difsqr_ia; break;
6219 case opSumSqr : func = &sumsqr_ia; break;
6220 case opSqrSum : func = &sqrsum_ia; break;
6221 case opSqrDif : func = &sqrdif_ia; break;
6222 case opAbsDif : func = &absdif_ia; break;
6223 case opThresh : func = &thresh_ia; break;
6224 case opAMClip : func = &amclip_ia; break;
6225 case opScaleNeg : func = &scaleneg_ia; break;
6226 case opClip2 : func = &clip2_ia_nova_64; break;
6227 case opFold2 : func = &fold2_ia; break;
6228 case opWrap2 : func = &wrap2_ia; break;
6229 case opExcess : func = &excess_ia; break;
6230 //case opFirstArg : func = &firstarg_aa; break;
6231 //case opSecondArg : func = &secondarg_aa; break;
6232 default : func = &add_ia; break;
6234 } else {
6235 // this should have been caught by mBufLength == 1
6236 func = &zero_aa;
6238 break;
6241 return func;
6245 static BinaryOpFunc ChooseNovaSimdFunc(BinaryOpUGen *unit)
6247 if (BUFLENGTH == 64)
6248 return ChooseNovaSimdFunc_64(unit);
6250 BinaryOpFunc func = &zero_1;
6252 int rateA = INRATE(0);
6253 int rateB = INRATE(1);
6255 switch (rateA) {
6256 case calc_FullRate:
6257 switch (rateB) {
6258 case calc_FullRate:
6259 switch (unit->mSpecialIndex) {
6260 //case opSilence2 : func = &zero_aa; break;
6261 case opAdd : func = &add_aa_nova; break;
6262 case opSub : func = &sub_aa_nova; break;
6263 case opMul : func = &mul_aa_nova; break;
6264 case opFDiv : func = &div_aa_nova; break;
6265 case opMod : func = &mod_aa; break;
6266 case opEQ : func = &eq_aa_nova; break;
6267 case opNE : func = &neq_aa_nova; break;
6268 case opLT : func = &lt_aa_nova; break;
6269 case opGT : func = &gt_aa_nova; break;
6270 case opLE : func = &le_aa_nova; break;
6271 case opGE : func = &ge_aa_nova; break;
6272 case opMin : func = &min_aa_nova; break;
6273 case opMax : func = &max_aa_nova; break;
6274 case opBitAnd : func = &and_aa; break;
6275 case opBitOr : func = &or_aa; break;
6276 case opBitXor : func = &xor_aa; break;
6277 case opShiftRight : func = &rightShift_aa; break;
6278 case opShiftLeft : func = &leftShift_aa; break;
6279 case opRound : func = &round_aa; break;
6280 case opRoundUp : func = &roundUp_aa; break;
6281 case opTrunc : func = &trunc_aa; break;
6282 case opAtan2 : func = &atan2_aa; break;
6283 case opHypot : func = &hypot_aa; break;
6284 case opHypotx : func = &hypotx_aa; break;
6285 case opPow : func = &pow_aa_nova; break;
6286 case opRing1 : func = &ring1_aa; break;
6287 case opRing2 : func = &ring2_aa; break;
6288 case opRing3 : func = &ring3_aa; break;
6289 case opRing4 : func = &ring4_aa; break;
6290 case opDifSqr : func = &difsqr_aa; break;
6291 case opSumSqr : func = &sumsqr_aa; break;
6292 case opSqrSum : func = &sqrsum_aa; break;
6293 case opSqrDif : func = &sqrdif_aa; break;
6294 case opAbsDif : func = &absdif_aa; break;
6295 case opThresh : func = &thresh_aa; break;
6296 case opAMClip : func = &amclip_aa; break;
6297 case opScaleNeg : func = &scaleneg_aa; break;
6298 case opClip2 : func = &clip2_aa_nova; break;
6299 case opFold2 : func = &fold2_aa; break;
6300 case opWrap2 : func = &wrap2_aa; break;
6301 case opExcess : func = &excess_aa; break;
6302 case opFirstArg : func = &firstarg_aa_nova; break;
6303 //case opSecondArg : func = &secondarg_aa_nova; break;
6304 default : func = &add_aa; break;
6306 break;
6307 case calc_BufRate :
6308 switch (unit->mSpecialIndex) {
6309 //case opSilence2 : func = &zero_aa; break;
6310 case opAdd : func = &add_ak_nova; break;
6311 case opSub : func = &sub_ak_nova; break;
6312 case opMul : func = &mul_ak_nova; break;
6313 case opFDiv : func = &div_ak_nova; break;
6314 case opMod : func = &mod_ak; break;
6315 case opEQ : func = &eq_ak_nova; break;
6316 case opNE : func = &neq_ak_nova; break;
6317 case opLT : func = &lt_ak_nova; break;
6318 case opGT : func = &gt_ak_nova; break;
6319 case opLE : func = &le_ak_nova; break;
6320 case opGE : func = &ge_ak_nova; break;
6321 case opMin : func = &min_ak_nova; break;
6322 case opMax : func = &max_ak_nova; break;
6323 case opBitAnd : func = &and_ak; break;
6324 case opBitOr : func = &or_ak; break;
6325 case opBitXor : func = &xor_ak; break;
6326 case opShiftRight : func = &rightShift_ak; break;
6327 case opShiftLeft : func = &leftShift_ak; break;
6328 case opRound : func = &round_ak; break;
6329 case opRoundUp : func = &roundUp_ak; break;
6330 case opTrunc : func = &trunc_ak; break;
6331 case opAtan2 : func = &atan2_ak; break;
6332 case opHypot : func = &hypot_ak; break;
6333 case opHypotx : func = &hypotx_ak; break;
6334 case opPow : func = &pow_ak_nova; break;
6335 case opRing1 : func = &ring1_ak; break;
6336 case opRing2 : func = &ring2_ak; break;
6337 case opRing3 : func = &ring3_ak; break;
6338 case opRing4 : func = &ring4_ak; break;
6339 case opDifSqr : func = &difsqr_ak; break;
6340 case opSumSqr : func = &sumsqr_ak; break;
6341 case opSqrSum : func = &sqrsum_ak; break;
6342 case opSqrDif : func = &sqrdif_ak; break;
6343 case opAbsDif : func = &absdif_ak; break;
6344 case opThresh : func = &thresh_ak; break;
6345 case opAMClip : func = &amclip_ak; break;
6346 case opScaleNeg : func = &scaleneg_ak; break;
6347 case opClip2 : func = &clip2_ak_nova; break;
6348 case opFold2 : func = &fold2_ak; break;
6349 case opWrap2 : func = &wrap2_ak; break;
6350 case opExcess : func = &excess_ak; break;
6351 case opFirstArg : func = &firstarg_aa; break;
6352 //case opSecondArg : func = &secondarg_aa; break;
6353 default : func = &add_ak; break;
6355 break;
6356 case calc_ScalarRate :
6357 switch (unit->mSpecialIndex) {
6358 //case opSilence2 : func = &zero_aa; break;
6359 case opAdd : func = &add_ai_nova; break;
6360 case opSub : func = &sub_ai_nova; break;
6361 case opMul : func = &mul_ai_nova; break;
6362 case opFDiv : func = &div_ai_nova; break;
6363 case opMod : func = &mod_ai; break;
6364 case opEQ : func = &eq_ai_nova; break;
6365 case opNE : func = &neq_ai_nova; break;
6366 case opLT : func = &lt_ai_nova; break;
6367 case opGT : func = &gt_ai_nova; break;
6368 case opLE : func = &le_ai_nova; break;
6369 case opGE : func = &ge_ai_nova; break;
6370 case opMin : func = &min_ai_nova; break;
6371 case opMax : func = &max_ai_nova; break;
6372 case opBitAnd : func = &and_ai; break;
6373 case opBitOr : func = &or_ai; break;
6374 case opBitXor : func = &xor_ai; break;
6375 case opShiftRight : func = &rightShift_ai; break;
6376 case opShiftLeft : func = &leftShift_ai; break;
6377 case opRound : func = &round_ai; break;
6378 case opRoundUp : func = &roundUp_ai; break;
6379 case opTrunc : func = &trunc_ai; break;
6380 case opAtan2 : func = &atan2_ai; break;
6381 case opHypot : func = &hypot_ai; break;
6382 case opHypotx : func = &hypotx_ai; break;
6383 case opPow : func = &pow_ai_nova; break;
6384 case opRing1 : func = &ring1_ai; break;
6385 case opRing2 : func = &ring2_ai; break;
6386 case opRing3 : func = &ring3_ai; break;
6387 case opRing4 : func = &ring4_ai; break;
6388 case opDifSqr : func = &difsqr_ai; break;
6389 case opSumSqr : func = &sumsqr_ai; break;
6390 case opSqrSum : func = &sqrsum_ai; break;
6391 case opSqrDif : func = &sqrdif_ai; break;
6392 case opAbsDif : func = &absdif_ai; break;
6393 case opThresh : func = &thresh_ai; break;
6394 case opAMClip : func = &amclip_ai; break;
6395 case opScaleNeg : func = &scaleneg_ai; break;
6396 case opClip2 : func = &clip2_ai_nova; break;
6397 case opFold2 : func = &fold2_ai; break;
6398 case opWrap2 : func = &wrap2_ai; break;
6399 case opExcess : func = &excess_ai; break;
6400 case opFirstArg : func = &firstarg_aa; break;
6401 //case opSecondArg : func = &secondarg_aa; break;
6402 default : func = &add_ai; break;
6405 break;
6406 case calc_BufRate :
6407 if (rateB == calc_FullRate) {
6408 switch (unit->mSpecialIndex) {
6409 //case opSilence2 : func = &zero_aa; break;
6410 case opAdd : func = &add_ka_nova; break;
6411 case opSub : func = &sub_ka_nova; break;
6412 case opMul : func = &mul_ka_nova; break;
6413 case opFDiv : func = &div_ka_nova; break;
6414 case opMod : func = &mod_ka; break;
6415 case opEQ : func = &eq_ka_nova; break;
6416 case opNE : func = &neq_ka_nova; break;
6417 case opLT : func = &lt_ka_nova; break;
6418 case opGT : func = &gt_ka_nova; break;
6419 case opLE : func = &le_ka_nova; break;
6420 case opGE : func = &ge_ka_nova; break;
6421 case opMin : func = &min_ka_nova; break;
6422 case opMax : func = &max_ka_nova; break;
6423 case opBitAnd : func = &and_ka; break;
6424 case opBitOr : func = &or_ka; break;
6425 case opBitXor : func = &xor_ka; break;
6426 case opShiftRight : func = &rightShift_ka; break;
6427 case opShiftLeft : func = &leftShift_ka; break;
6428 case opRound : func = &round_ka; break;
6429 case opRoundUp : func = &roundUp_ka; break;
6430 case opTrunc : func = &trunc_ka; break;
6431 case opAtan2 : func = &atan2_ka; break;
6432 case opHypot : func = &hypot_ka; break;
6433 case opHypotx : func = &hypotx_ka; break;
6434 case opPow : func = &pow_ka_nova; break;
6435 case opRing1 : func = &ring1_ka; break;
6436 case opRing2 : func = &ring2_ka; break;
6437 case opRing3 : func = &ring3_ka; break;
6438 case opRing4 : func = &ring4_ka; break;
6439 case opDifSqr : func = &difsqr_ka; break;
6440 case opSumSqr : func = &sumsqr_ka; break;
6441 case opSqrSum : func = &sqrsum_ka; break;
6442 case opSqrDif : func = &sqrdif_ka; break;
6443 case opAbsDif : func = &absdif_ka; break;
6444 case opThresh : func = &thresh_ka; break;
6445 case opAMClip : func = &amclip_ka; break;
6446 case opScaleNeg : func = &scaleneg_ka; break;
6447 case opClip2 : func = &clip2_ka_nova; break;
6448 case opFold2 : func = &fold2_ka; break;
6449 case opWrap2 : func = &wrap2_ka; break;
6450 case opExcess : func = &excess_ka; break;
6451 //case opFirstArg : func = &firstarg_aa; break;
6452 //case opSecondArg : func = &secondarg_aa; break;
6453 default : func = &add_ka; break;
6455 } else {
6456 // this should have been caught by mBufLength == 1
6457 func = &zero_aa;
6459 break;
6460 case calc_ScalarRate :
6461 if (rateB == calc_FullRate) {
6462 switch (unit->mSpecialIndex) {
6463 //case opSilence2 : func = &zero_aa; break;
6464 case opAdd : func = &add_ia_nova; break;
6465 case opSub : func = &sub_ia_nova; break;
6466 case opMul : func = &mul_ia_nova; break;
6467 case opFDiv : func = &div_ia_nova; break;
6468 case opMod : func = &mod_ia; break;
6469 case opEQ : func = &eq_ia_nova; break;
6470 case opNE : func = &neq_ia_nova; break;
6471 case opLT : func = &lt_ia_nova; break;
6472 case opGT : func = &gt_ia_nova; break;
6473 case opLE : func = &le_ia_nova; break;
6474 case opGE : func = &ge_ia_nova; break;
6475 case opMin : func = &min_ia_nova; break;
6476 case opMax : func = &max_ia_nova; break;
6477 case opBitAnd : func = &and_ia; break;
6478 case opBitOr : func = &or_ia; break;
6479 case opBitXor : func = &xor_ia; break;
6480 case opShiftRight : func = &rightShift_ia; break;
6481 case opShiftLeft : func = &leftShift_ia; break;
6482 case opRound : func = &round_ia; break;
6483 case opRoundUp : func = &roundUp_ia; break;
6484 case opTrunc : func = &trunc_ia; break;
6485 case opAtan2 : func = &atan2_ia; break;
6486 case opHypot : func = &hypot_ia; break;
6487 case opHypotx : func = &hypotx_ia; break;
6488 case opPow : func = &pow_ia_nova; break;
6489 case opRing1 : func = &ring1_ia; break;
6490 case opRing2 : func = &ring2_ia; break;
6491 case opRing3 : func = &ring3_ia; break;
6492 case opRing4 : func = &ring4_ia; break;
6493 case opDifSqr : func = &difsqr_ia; break;
6494 case opSumSqr : func = &sumsqr_ia; break;
6495 case opSqrSum : func = &sqrsum_ia; break;
6496 case opSqrDif : func = &sqrdif_ia; break;
6497 case opAbsDif : func = &absdif_ia; break;
6498 case opThresh : func = &thresh_ia; break;
6499 case opAMClip : func = &amclip_ia; break;
6500 case opScaleNeg : func = &scaleneg_ia; break;
6501 case opClip2 : func = &clip2_ia_nova; break;
6502 case opFold2 : func = &fold2_ia; break;
6503 case opWrap2 : func = &wrap2_ia; break;
6504 case opExcess : func = &excess_ia; break;
6505 //case opFirstArg : func = &firstarg_aa; break;
6506 //case opSecondArg : func = &secondarg_aa; break;
6507 default : func = &add_ia; break;
6509 } else {
6510 // this should have been caught by mBufLength == 1
6511 func = &zero_aa;
6513 break;
6516 return func;
6519 #endif
6521 bool ChooseOperatorFunc(BinaryOpUGen *unit)
6523 //Print("->ChooseOperatorFunc %d\n", unit->mSpecialIndex);
6524 BinaryOpFunc func = &zero_aa;
6525 bool ret = false;
6527 if (BUFLENGTH == 1) {
6528 if (unit->mCalcRate == calc_DemandRate) {
6529 func = ChooseDemandFunc(unit);
6530 } else {
6531 func = ChooseOneSampleFunc(unit);
6533 #if defined(NOVA_SIMD)
6534 } else if (!(BUFLENGTH & 15)) {
6535 /* select normal function for initialization */
6536 func = ChooseNormalFunc(unit);
6537 func(unit, 1);
6539 /* select simd function */
6540 func = ChooseNovaSimdFunc(unit);
6541 ret = true;
6542 #endif
6543 } else {
6544 func = ChooseNormalFunc(unit);
6546 unit->mCalcFunc = (UnitCalcFunc)func;
6547 //Print("<-ChooseOperatorFunc %p\n", func);
6548 //Print("calc %d\n", unit->mCalcRate);
6549 return ret;
6555 ////////////////////////////////////////////////////////////////////////////////////////////////////////
6558 PluginLoad(BinaryOp)
6560 ft = inTable;
6562 DefineSimpleUnit(BinaryOpUGen);