class library: SynthDef - replaceUGen fixes
[supercollider.git] / server / plugins / BinaryOpUGens.cpp
blobadc5a975f8250e986dacd12fb01d8faebd76be98
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"
35 #if defined (__GNUC__) && !(defined(__clang__))
36 #define inline_functions __attribute__ ((flatten))
37 #else
38 #define inline_functions
39 #endif
41 using nova::slope_argument;
43 #define NOVA_BINARY_WRAPPER(SCNAME, NOVANAME) \
44 inline_functions void SCNAME##_aa_nova(BinaryOpUGen *unit, int inNumSamples) \
45 { \
46 nova::NOVANAME##_vec_simd(OUT(0), IN(0), IN(1), inNumSamples); \
47 } \
49 inline_functions void SCNAME##_aa_nova_64(BinaryOpUGen *unit, int inNumSamples) \
50 { \
51 nova::NOVANAME##_vec_simd<64>(OUT(0), IN(0), IN(1)); \
52 } \
54 inline_functions void SCNAME##_ia_nova(BinaryOpUGen *unit, int inNumSamples) \
55 { \
56 float xa = ZIN0(0); \
58 nova::NOVANAME##_vec_simd(OUT(0), xa, IN(1), inNumSamples); \
59 unit->mPrevA = xa; \
60 } \
62 inline_functions void SCNAME##_ia_nova_64(BinaryOpUGen *unit, int inNumSamples) \
63 { \
64 float xa = ZIN0(0); \
66 nova::NOVANAME##_vec_simd<64>(OUT(0), xa, IN(1)); \
67 unit->mPrevA = xa; \
68 } \
70 inline_functions void SCNAME##_ai_nova(BinaryOpUGen *unit, int inNumSamples) \
71 { \
72 float xb = ZIN0(1); \
74 nova::NOVANAME##_vec_simd(OUT(0), IN(0), xb, inNumSamples); \
75 unit->mPrevB = xb; \
76 } \
78 inline_functions void SCNAME##_ai_nova_64(BinaryOpUGen *unit, int inNumSamples) \
79 { \
80 float xb = ZIN0(1); \
82 nova::NOVANAME##_vec_simd<64>(OUT(0), IN(0), xb); \
83 unit->mPrevB = xb; \
86 #define NOVA_BINARY_WRAPPER_K(SCNAME, NOVANAME) \
87 inline_functions void SCNAME##_aa_nova(BinaryOpUGen *unit, int inNumSamples) \
88 { \
89 nova::NOVANAME##_vec_simd(OUT(0), IN(0), IN(1), inNumSamples); \
90 } \
92 inline_functions void SCNAME##_aa_nova_64(BinaryOpUGen *unit, int inNumSamples) \
93 { \
94 nova::NOVANAME##_vec_simd<64>(OUT(0), IN(0), IN(1)); \
95 } \
97 inline_functions void SCNAME##_ia_nova(BinaryOpUGen *unit, int inNumSamples) \
98 { \
99 float xa = ZIN0(0); \
101 nova::NOVANAME##_vec_simd(OUT(0), xa, IN(1), inNumSamples); \
102 unit->mPrevA = xa; \
105 inline_functions void SCNAME##_ia_nova_64(BinaryOpUGen *unit, int inNumSamples) \
107 float xa = ZIN0(0); \
109 nova::NOVANAME##_vec_simd<64>(OUT(0), xa, IN(1)); \
110 unit->mPrevA = xa; \
113 inline_functions void SCNAME##_ai_nova(BinaryOpUGen *unit, int inNumSamples) \
115 float xb = ZIN0(1); \
117 nova::NOVANAME##_vec_simd(OUT(0), IN(0), xb, inNumSamples); \
118 unit->mPrevB = xb; \
121 inline_functions void SCNAME##_ai_nova_64(BinaryOpUGen *unit, int inNumSamples) \
123 float xb = ZIN0(1); \
125 nova::NOVANAME##_vec_simd<64>(OUT(0), IN(0), xb); \
126 unit->mPrevB = xb; \
129 inline_functions void SCNAME##_ak_nova(BinaryOpUGen *unit, int inNumSamples) \
131 float xb = unit->mPrevB; \
132 float next_b = ZIN0(1); \
134 if (xb == next_b) { \
135 nova::NOVANAME##_vec_simd(OUT(0), IN(0), xb, inNumSamples); \
136 } else { \
137 float slope = CALCSLOPE(next_b, xb); \
138 nova::NOVANAME##_vec_simd(OUT(0), IN(0), slope_argument(xb, slope), inNumSamples); \
139 unit->mPrevB = next_b; \
143 inline_functions void SCNAME##_ak_nova_64(BinaryOpUGen *unit, int inNumSamples) \
145 float xb = unit->mPrevB; \
146 float next_b = ZIN0(1); \
148 if (xb == next_b) { \
149 nova::NOVANAME##_vec_simd<64>(OUT(0), IN(0), xb); \
150 } else { \
151 float slope = CALCSLOPE(next_b, xb); \
152 nova::NOVANAME##_vec_simd(OUT(0), IN(0), slope_argument(xb, slope), inNumSamples); \
153 unit->mPrevB = next_b; \
157 inline_functions void SCNAME##_ka_nova(BinaryOpUGen *unit, int inNumSamples) \
159 float xa = unit->mPrevA; \
160 float next_a = ZIN0(0); \
162 if (xa == next_a) { \
163 nova::NOVANAME##_vec_simd(OUT(0), xa, IN(1), inNumSamples); \
164 } else { \
165 float slope = CALCSLOPE(next_a, xa); \
166 nova::NOVANAME##_vec_simd(OUT(0), slope_argument(xa, slope), IN(1), inNumSamples); \
167 unit->mPrevA = next_a; \
170 inline_functions void SCNAME##_ka_nova_64(BinaryOpUGen *unit, int inNumSamples) \
172 float xa = unit->mPrevA; \
173 float next_a = ZIN0(0); \
175 if (xa == next_a) { \
176 nova::NOVANAME##_vec_simd<64>(OUT(0), xa, IN(1)); \
177 } else { \
178 float slope = CALCSLOPE(next_a, xa); \
179 nova::NOVANAME##_vec_simd(OUT(0), slope_argument(xa, slope), IN(1), inNumSamples); \
180 unit->mPrevA = next_a; \
185 #endif
187 using namespace std; // for math functions
189 static InterfaceTable *ft;
191 //////////////////////////////////////////////////////////////////////////////////////////////////
194 /* special binary math operators */
195 enum {
196 opAdd,
197 opSub,
198 opMul,
199 opIDiv,
200 opFDiv,
201 opMod,
202 opEQ,
203 opNE,
204 opLT,
205 opGT,
206 opLE,
207 opGE,
208 //opIdentical,
209 //opNotIdentical,
211 opMin,
212 opMax,
213 opBitAnd,
214 opBitOr,
215 opBitXor,
216 opLCM,
217 opGCD,
218 opRound,
219 opRoundUp,
220 opTrunc,
221 opAtan2,
222 opHypot,
223 opHypotx,
224 opPow,
225 opShiftLeft, //
226 opShiftRight, //
227 opUnsignedShift, //
228 opFill, //
229 opRing1, // a * (b + 1) == a * b + a
230 opRing2, // a * b + a + b
231 opRing3, // a*a*b
232 opRing4, // a*a*b - a*b*b
233 opDifSqr, // a*a - b*b
234 opSumSqr, // a*a + b*b
235 opSqrSum, // (a + b)^2
236 opSqrDif, // (a - b)^2
237 opAbsDif, // |a - b|
238 opThresh,
239 opAMClip,
240 opScaleNeg,
241 opClip2,
242 opExcess,
243 opFold2,
244 opWrap2,
245 opFirstArg,
246 opRandRange,
247 opExpRandRange,
249 opNumBinarySelectors
253 inline float sc_andt(float a, float b)
255 return int(a) & int(b);
258 inline float sc_ort(float a, float b)
260 return int(a) | int(b);
263 inline float sc_xort(float a, float b)
265 return int(a) ^ int(b);
268 inline float sc_rst(float a, float b)
270 return int(a) >> int(b);
273 inline float sc_lst(float a, float b)
275 return int(a) << int(b);
278 struct BinaryOpUGen : public Unit
280 float mPrevA, mPrevB;
283 typedef void (*BinaryOpFunc)(BinaryOpUGen *unit, int inNumSamples);
285 extern "C"
288 void BinaryOpUGen_Ctor(BinaryOpUGen *unit);
290 //void zero_d(BinaryOpUGen *unit, int inNumSamples);
291 void zero_1(BinaryOpUGen *unit, int inNumSamples);
292 void zero_aa(BinaryOpUGen *unit, int inNumSamples);
293 void firstarg_d(BinaryOpUGen *unit, int inNumSamples);
294 void firstarg_1(BinaryOpUGen *unit, int inNumSamples);
295 void firstarg_aa(BinaryOpUGen *unit, int inNumSamples);
296 void secondarg_d(BinaryOpUGen *unit, int inNumSamples);
297 void secondarg_1(BinaryOpUGen *unit, int inNumSamples);
298 void secondarg_aa(BinaryOpUGen *unit, int inNumSamples);
299 void add_d(BinaryOpUGen *unit, int inNumSamples);
300 void add_1(BinaryOpUGen *unit, int inNumSamples);
301 void add_aa(BinaryOpUGen *unit, int inNumSamples);
302 void add_ak(BinaryOpUGen *unit, int inNumSamples);
303 void add_ka(BinaryOpUGen *unit, int inNumSamples);
304 void add_ai(BinaryOpUGen *unit, int inNumSamples);
305 void add_ia(BinaryOpUGen *unit, int inNumSamples);
306 void sub_d(BinaryOpUGen *unit, int inNumSamples);
307 void sub_1(BinaryOpUGen *unit, int inNumSamples);
308 void sub_aa(BinaryOpUGen *unit, int inNumSamples);
309 void sub_ak(BinaryOpUGen *unit, int inNumSamples);
310 void sub_ka(BinaryOpUGen *unit, int inNumSamples);
311 void sub_ai(BinaryOpUGen *unit, int inNumSamples);
312 void sub_ia(BinaryOpUGen *unit, int inNumSamples);
313 void mul_d(BinaryOpUGen *unit, int inNumSamples);
314 void mul_1(BinaryOpUGen *unit, int inNumSamples);
315 void mul_aa(BinaryOpUGen *unit, int inNumSamples);
316 void mul_ak(BinaryOpUGen *unit, int inNumSamples);
317 void mul_ka(BinaryOpUGen *unit, int inNumSamples);
318 void mul_ai(BinaryOpUGen *unit, int inNumSamples);
319 void mul_ia(BinaryOpUGen *unit, int inNumSamples);
320 void div_d(BinaryOpUGen *unit, int inNumSamples);
321 void div_1(BinaryOpUGen *unit, int inNumSamples);
322 void div_aa(BinaryOpUGen *unit, int inNumSamples);
323 void div_ak(BinaryOpUGen *unit, int inNumSamples);
324 void div_ka(BinaryOpUGen *unit, int inNumSamples);
325 void div_ai(BinaryOpUGen *unit, int inNumSamples);
326 void div_ia(BinaryOpUGen *unit, int inNumSamples);
327 void mod_d(BinaryOpUGen *unit, int inNumSamples);
328 void mod_1(BinaryOpUGen *unit, int inNumSamples);
329 void mod_aa(BinaryOpUGen *unit, int inNumSamples);
330 void mod_ak(BinaryOpUGen *unit, int inNumSamples);
331 void mod_ka(BinaryOpUGen *unit, int inNumSamples);
332 void mod_ai(BinaryOpUGen *unit, int inNumSamples);
333 void mod_ia(BinaryOpUGen *unit, int inNumSamples);
334 void max_d(BinaryOpUGen *unit, int inNumSamples);
335 void max_1(BinaryOpUGen *unit, int inNumSamples);
336 void max_aa(BinaryOpUGen *unit, int inNumSamples);
337 void max_ak(BinaryOpUGen *unit, int inNumSamples);
338 void max_ka(BinaryOpUGen *unit, int inNumSamples);
339 void max_ai(BinaryOpUGen *unit, int inNumSamples);
340 void max_ia(BinaryOpUGen *unit, int inNumSamples);
341 void min_d(BinaryOpUGen *unit, int inNumSamples);
342 void min_1(BinaryOpUGen *unit, int inNumSamples);
343 void min_aa(BinaryOpUGen *unit, int inNumSamples);
344 void min_ak(BinaryOpUGen *unit, int inNumSamples);
345 void min_ka(BinaryOpUGen *unit, int inNumSamples);
346 void min_ai(BinaryOpUGen *unit, int inNumSamples);
347 void min_ia(BinaryOpUGen *unit, int inNumSamples);
349 void and_d(BinaryOpUGen *unit, int inNumSamples);
350 void and_1(BinaryOpUGen *unit, int inNumSamples);
351 void and_aa(BinaryOpUGen *unit, int inNumSamples);
352 void and_ak(BinaryOpUGen *unit, int inNumSamples);
353 void and_ka(BinaryOpUGen *unit, int inNumSamples);
354 void and_ai(BinaryOpUGen *unit, int inNumSamples);
355 void and_ia(BinaryOpUGen *unit, int inNumSamples);
357 void or_d(BinaryOpUGen *unit, int inNumSamples);
358 void or_1(BinaryOpUGen *unit, int inNumSamples);
359 void or_aa(BinaryOpUGen *unit, int inNumSamples);
360 void or_ak(BinaryOpUGen *unit, int inNumSamples);
361 void or_ka(BinaryOpUGen *unit, int inNumSamples);
362 void or_ai(BinaryOpUGen *unit, int inNumSamples);
363 void or_ia(BinaryOpUGen *unit, int inNumSamples);
365 void xor_d(BinaryOpUGen *unit, int inNumSamples);
366 void xor_1(BinaryOpUGen *unit, int inNumSamples);
367 void xor_aa(BinaryOpUGen *unit, int inNumSamples);
368 void xor_ak(BinaryOpUGen *unit, int inNumSamples);
369 void xor_ka(BinaryOpUGen *unit, int inNumSamples);
370 void xor_ai(BinaryOpUGen *unit, int inNumSamples);
371 void xor_ia(BinaryOpUGen *unit, int inNumSamples);
373 void amclip_d(BinaryOpUGen *unit, int inNumSamples);
374 void amclip_1(BinaryOpUGen *unit, int inNumSamples);
375 void amclip_aa(BinaryOpUGen *unit, int inNumSamples);
376 void amclip_ak(BinaryOpUGen *unit, int inNumSamples);
377 void amclip_ka(BinaryOpUGen *unit, int inNumSamples);
378 void amclip_ai(BinaryOpUGen *unit, int inNumSamples);
379 void amclip_ia(BinaryOpUGen *unit, int inNumSamples);
380 void scaleneg_d(BinaryOpUGen *unit, int inNumSamples);
381 void scaleneg_1(BinaryOpUGen *unit, int inNumSamples);
382 void scaleneg_aa(BinaryOpUGen *unit, int inNumSamples);
383 void scaleneg_ak(BinaryOpUGen *unit, int inNumSamples);
384 void scaleneg_ka(BinaryOpUGen *unit, int inNumSamples);
385 void scaleneg_ai(BinaryOpUGen *unit, int inNumSamples);
386 void scaleneg_ia(BinaryOpUGen *unit, int inNumSamples);
387 void pow_d(BinaryOpUGen *unit, int inNumSamples);
388 void pow_1(BinaryOpUGen *unit, int inNumSamples);
389 void pow_aa(BinaryOpUGen *unit, int inNumSamples);
390 void pow_ak(BinaryOpUGen *unit, int inNumSamples);
391 void pow_ka(BinaryOpUGen *unit, int inNumSamples);
392 void pow_ai(BinaryOpUGen *unit, int inNumSamples);
393 void pow_ia(BinaryOpUGen *unit, int inNumSamples);
394 void ring1_d(BinaryOpUGen *unit, int inNumSamples);
395 void ring1_1(BinaryOpUGen *unit, int inNumSamples);
396 void ring1_aa(BinaryOpUGen *unit, int inNumSamples);
397 void ring1_ak(BinaryOpUGen *unit, int inNumSamples);
398 void ring1_ka(BinaryOpUGen *unit, int inNumSamples);
399 void ring1_ai(BinaryOpUGen *unit, int inNumSamples);
400 void ring1_ia(BinaryOpUGen *unit, int inNumSamples);
401 void ring2_d(BinaryOpUGen *unit, int inNumSamples);
402 void ring2_1(BinaryOpUGen *unit, int inNumSamples);
403 void ring2_aa(BinaryOpUGen *unit, int inNumSamples);
404 void ring2_ak(BinaryOpUGen *unit, int inNumSamples);
405 void ring2_ka(BinaryOpUGen *unit, int inNumSamples);
406 void ring2_ai(BinaryOpUGen *unit, int inNumSamples);
407 void ring2_ia(BinaryOpUGen *unit, int inNumSamples);
408 void ring3_d(BinaryOpUGen *unit, int inNumSamples);
409 void ring3_1(BinaryOpUGen *unit, int inNumSamples);
410 void ring3_aa(BinaryOpUGen *unit, int inNumSamples);
411 void ring3_ak(BinaryOpUGen *unit, int inNumSamples);
412 void ring3_ka(BinaryOpUGen *unit, int inNumSamples);
413 void ring3_ai(BinaryOpUGen *unit, int inNumSamples);
414 void ring3_ia(BinaryOpUGen *unit, int inNumSamples);
415 void ring4_d(BinaryOpUGen *unit, int inNumSamples);
416 void ring4_1(BinaryOpUGen *unit, int inNumSamples);
417 void ring4_aa(BinaryOpUGen *unit, int inNumSamples);
418 void ring4_ak(BinaryOpUGen *unit, int inNumSamples);
419 void ring4_ka(BinaryOpUGen *unit, int inNumSamples);
420 void ring4_ai(BinaryOpUGen *unit, int inNumSamples);
421 void ring4_ia(BinaryOpUGen *unit, int inNumSamples);
422 void thresh_d(BinaryOpUGen *unit, int inNumSamples);
423 void thresh_1(BinaryOpUGen *unit, int inNumSamples);
424 void thresh_aa(BinaryOpUGen *unit, int inNumSamples);
425 void thresh_ak(BinaryOpUGen *unit, int inNumSamples);
426 void thresh_ka(BinaryOpUGen *unit, int inNumSamples);
427 void thresh_ai(BinaryOpUGen *unit, int inNumSamples);
428 void thresh_ia(BinaryOpUGen *unit, int inNumSamples);
429 void clip2_d(BinaryOpUGen *unit, int inNumSamples);
430 void clip2_1(BinaryOpUGen *unit, int inNumSamples);
431 void clip2_aa(BinaryOpUGen *unit, int inNumSamples);
432 void clip2_ak(BinaryOpUGen *unit, int inNumSamples);
433 void clip2_ka(BinaryOpUGen *unit, int inNumSamples);
434 void clip2_ai(BinaryOpUGen *unit, int inNumSamples);
435 void clip2_ia(BinaryOpUGen *unit, int inNumSamples);
436 void fold2_d(BinaryOpUGen *unit, int inNumSamples);
437 void fold2_1(BinaryOpUGen *unit, int inNumSamples);
438 void fold2_aa(BinaryOpUGen *unit, int inNumSamples);
439 void fold2_ak(BinaryOpUGen *unit, int inNumSamples);
440 void fold2_ka(BinaryOpUGen *unit, int inNumSamples);
441 void fold2_ai(BinaryOpUGen *unit, int inNumSamples);
442 void fold2_ia(BinaryOpUGen *unit, int inNumSamples);
443 void wrap2_d(BinaryOpUGen *unit, int inNumSamples);
444 void wrap2_1(BinaryOpUGen *unit, int inNumSamples);
445 void wrap2_aa(BinaryOpUGen *unit, int inNumSamples);
446 void wrap2_ak(BinaryOpUGen *unit, int inNumSamples);
447 void wrap2_ka(BinaryOpUGen *unit, int inNumSamples);
448 void wrap2_ai(BinaryOpUGen *unit, int inNumSamples);
449 void wrap2_ia(BinaryOpUGen *unit, int inNumSamples);
450 void excess_d(BinaryOpUGen *unit, int inNumSamples);
451 void excess_1(BinaryOpUGen *unit, int inNumSamples);
452 void excess_aa(BinaryOpUGen *unit, int inNumSamples);
453 void excess_ak(BinaryOpUGen *unit, int inNumSamples);
454 void excess_ka(BinaryOpUGen *unit, int inNumSamples);
455 void excess_ai(BinaryOpUGen *unit, int inNumSamples);
456 void excess_ia(BinaryOpUGen *unit, int inNumSamples);
457 void lt_d(BinaryOpUGen *unit, int inNumSamples);
458 void lt_1(BinaryOpUGen *unit, int inNumSamples);
459 void lt_aa(BinaryOpUGen *unit, int inNumSamples);
460 void lt_ak(BinaryOpUGen *unit, int inNumSamples);
461 void lt_ka(BinaryOpUGen *unit, int inNumSamples);
462 void lt_ai(BinaryOpUGen *unit, int inNumSamples);
463 void lt_ia(BinaryOpUGen *unit, int inNumSamples);
464 void le_d(BinaryOpUGen *unit, int inNumSamples);
465 void le_1(BinaryOpUGen *unit, int inNumSamples);
466 void le_aa(BinaryOpUGen *unit, int inNumSamples);
467 void le_ak(BinaryOpUGen *unit, int inNumSamples);
468 void le_ka(BinaryOpUGen *unit, int inNumSamples);
469 void le_ai(BinaryOpUGen *unit, int inNumSamples);
470 void le_ia(BinaryOpUGen *unit, int inNumSamples);
471 void gt_d(BinaryOpUGen *unit, int inNumSamples);
472 void gt_1(BinaryOpUGen *unit, int inNumSamples);
473 void gt_aa(BinaryOpUGen *unit, int inNumSamples);
474 void gt_ak(BinaryOpUGen *unit, int inNumSamples);
475 void gt_ka(BinaryOpUGen *unit, int inNumSamples);
476 void gt_ai(BinaryOpUGen *unit, int inNumSamples);
477 void gt_ia(BinaryOpUGen *unit, int inNumSamples);
478 void ge_d(BinaryOpUGen *unit, int inNumSamples);
479 void ge_1(BinaryOpUGen *unit, int inNumSamples);
480 void ge_aa(BinaryOpUGen *unit, int inNumSamples);
481 void ge_ak(BinaryOpUGen *unit, int inNumSamples);
482 void ge_ka(BinaryOpUGen *unit, int inNumSamples);
483 void ge_ai(BinaryOpUGen *unit, int inNumSamples);
484 void ge_ia(BinaryOpUGen *unit, int inNumSamples);
485 void eq_d(BinaryOpUGen *unit, int inNumSamples);
486 void eq_1(BinaryOpUGen *unit, int inNumSamples);
487 void eq_aa(BinaryOpUGen *unit, int inNumSamples);
488 void eq_ak(BinaryOpUGen *unit, int inNumSamples);
489 void eq_ka(BinaryOpUGen *unit, int inNumSamples);
490 void eq_ai(BinaryOpUGen *unit, int inNumSamples);
491 void eq_ia(BinaryOpUGen *unit, int inNumSamples);
492 void neq_d(BinaryOpUGen *unit, int inNumSamples);
493 void neq_1(BinaryOpUGen *unit, int inNumSamples);
494 void neq_aa(BinaryOpUGen *unit, int inNumSamples);
495 void neq_ak(BinaryOpUGen *unit, int inNumSamples);
496 void neq_ka(BinaryOpUGen *unit, int inNumSamples);
497 void neq_ai(BinaryOpUGen *unit, int inNumSamples);
498 void neq_ia(BinaryOpUGen *unit, int inNumSamples);
499 void sumsqr_d(BinaryOpUGen *unit, int inNumSamples);
500 void sumsqr_1(BinaryOpUGen *unit, int inNumSamples);
501 void sumsqr_aa(BinaryOpUGen *unit, int inNumSamples);
502 void sumsqr_ak(BinaryOpUGen *unit, int inNumSamples);
503 void sumsqr_ka(BinaryOpUGen *unit, int inNumSamples);
504 void sumsqr_ai(BinaryOpUGen *unit, int inNumSamples);
505 void sumsqr_ia(BinaryOpUGen *unit, int inNumSamples);
506 void difsqr_d(BinaryOpUGen *unit, int inNumSamples);
507 void difsqr_1(BinaryOpUGen *unit, int inNumSamples);
508 void difsqr_aa(BinaryOpUGen *unit, int inNumSamples);
509 void difsqr_ak(BinaryOpUGen *unit, int inNumSamples);
510 void difsqr_ka(BinaryOpUGen *unit, int inNumSamples);
511 void difsqr_ai(BinaryOpUGen *unit, int inNumSamples);
512 void difsqr_ia(BinaryOpUGen *unit, int inNumSamples);
513 void sqrsum_d(BinaryOpUGen *unit, int inNumSamples);
514 void sqrsum_1(BinaryOpUGen *unit, int inNumSamples);
515 void sqrsum_aa(BinaryOpUGen *unit, int inNumSamples);
516 void sqrsum_ak(BinaryOpUGen *unit, int inNumSamples);
517 void sqrsum_ka(BinaryOpUGen *unit, int inNumSamples);
518 void sqrsum_ai(BinaryOpUGen *unit, int inNumSamples);
519 void sqrsum_ia(BinaryOpUGen *unit, int inNumSamples);
520 void sqrdif_d(BinaryOpUGen *unit, int inNumSamples);
521 void sqrdif_1(BinaryOpUGen *unit, int inNumSamples);
522 void sqrdif_aa(BinaryOpUGen *unit, int inNumSamples);
523 void sqrdif_ak(BinaryOpUGen *unit, int inNumSamples);
524 void sqrdif_ka(BinaryOpUGen *unit, int inNumSamples);
525 void sqrdif_ai(BinaryOpUGen *unit, int inNumSamples);
526 void sqrdif_ia(BinaryOpUGen *unit, int inNumSamples);
527 void absdif_d(BinaryOpUGen *unit, int inNumSamples);
528 void absdif_1(BinaryOpUGen *unit, int inNumSamples);
529 void absdif_aa(BinaryOpUGen *unit, int inNumSamples);
530 void absdif_ak(BinaryOpUGen *unit, int inNumSamples);
531 void absdif_ka(BinaryOpUGen *unit, int inNumSamples);
532 void absdif_ai(BinaryOpUGen *unit, int inNumSamples);
533 void absdif_ia(BinaryOpUGen *unit, int inNumSamples);
534 void round_d(BinaryOpUGen *unit, int inNumSamples);
535 void round_1(BinaryOpUGen *unit, int inNumSamples);
536 void round_aa(BinaryOpUGen *unit, int inNumSamples);
537 void round_ak(BinaryOpUGen *unit, int inNumSamples);
538 void round_ka(BinaryOpUGen *unit, int inNumSamples);
539 void round_ai(BinaryOpUGen *unit, int inNumSamples);
540 void round_ia(BinaryOpUGen *unit, int inNumSamples);
541 void roundUp_d(BinaryOpUGen *unit, int inNumSamples);
542 void roundUp_1(BinaryOpUGen *unit, int inNumSamples);
543 void roundUp_aa(BinaryOpUGen *unit, int inNumSamples);
544 void roundUp_ak(BinaryOpUGen *unit, int inNumSamples);
545 void roundUp_ka(BinaryOpUGen *unit, int inNumSamples);
546 void roundUp_ai(BinaryOpUGen *unit, int inNumSamples);
547 void roundUp_ia(BinaryOpUGen *unit, int inNumSamples);
548 void trunc_d(BinaryOpUGen *unit, int inNumSamples);
549 void trunc_1(BinaryOpUGen *unit, int inNumSamples);
550 void trunc_aa(BinaryOpUGen *unit, int inNumSamples);
551 void trunc_ak(BinaryOpUGen *unit, int inNumSamples);
552 void trunc_ka(BinaryOpUGen *unit, int inNumSamples);
553 void trunc_ai(BinaryOpUGen *unit, int inNumSamples);
554 void trunc_ia(BinaryOpUGen *unit, int inNumSamples);
555 void atan2_d(BinaryOpUGen *unit, int inNumSamples);
556 void atan2_1(BinaryOpUGen *unit, int inNumSamples);
557 void atan2_aa(BinaryOpUGen *unit, int inNumSamples);
558 void atan2_ak(BinaryOpUGen *unit, int inNumSamples);
559 void atan2_ka(BinaryOpUGen *unit, int inNumSamples);
560 void atan2_ai(BinaryOpUGen *unit, int inNumSamples);
561 void atan2_ia(BinaryOpUGen *unit, int inNumSamples);
562 void hypot_d(BinaryOpUGen *unit, int inNumSamples);
563 void hypot_1(BinaryOpUGen *unit, int inNumSamples);
564 void hypot_aa(BinaryOpUGen *unit, int inNumSamples);
565 void hypot_ak(BinaryOpUGen *unit, int inNumSamples);
566 void hypot_ka(BinaryOpUGen *unit, int inNumSamples);
567 void hypot_ai(BinaryOpUGen *unit, int inNumSamples);
568 void hypot_ia(BinaryOpUGen *unit, int inNumSamples);
569 void hypotx_d(BinaryOpUGen *unit, int inNumSamples);
570 void hypotx_1(BinaryOpUGen *unit, int inNumSamples);
571 void hypotx_aa(BinaryOpUGen *unit, int inNumSamples);
572 void hypotx_ak(BinaryOpUGen *unit, int inNumSamples);
573 void hypotx_ka(BinaryOpUGen *unit, int inNumSamples);
574 void hypotx_ai(BinaryOpUGen *unit, int inNumSamples);
575 void hypotx_ia(BinaryOpUGen *unit, int inNumSamples);
578 ////////////////////////////////////////////////////////////////////////////////////////////////////////
580 static bool ChooseOperatorFunc(BinaryOpUGen *unit);
582 void BinaryOpUGen_Ctor(BinaryOpUGen *unit)
584 unit->mPrevA = ZIN0(0);
585 unit->mPrevB = ZIN0(1);
586 bool initialized = ChooseOperatorFunc(unit);
587 if (unit->mCalcRate == calc_DemandRate) {
588 OUT0(0) = 0.f;
589 } else {
590 if (!initialized)
591 (unit->mCalcFunc)(unit, 1);
596 void zero_d(BinaryOpUGen *unit, int inNumSamples)
598 if (inNumSamples) {
599 float a = DEMANDINPUT_A(0, inNumSamples);
600 float b = DEMANDINPUT_A(1, inNumSamples);
601 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : 0.f;
602 } else {
603 RESETINPUT(0);
604 RESETINPUT(1);
609 void firstarg_d(BinaryOpUGen *unit, int inNumSamples)
611 if (inNumSamples) {
612 float a = DEMANDINPUT_A(0, inNumSamples);
613 float b = DEMANDINPUT_A(1, inNumSamples);
614 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : a;
615 } else {
616 RESETINPUT(0);
617 RESETINPUT(1);
621 void secondarg_d(BinaryOpUGen *unit, int inNumSamples)
623 if (inNumSamples) {
624 float a = DEMANDINPUT_A(0, inNumSamples);
625 float b = DEMANDINPUT_A(1, inNumSamples);
626 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : b;
627 } else {
628 RESETINPUT(0);
629 RESETINPUT(1);
633 void add_d(BinaryOpUGen *unit, int inNumSamples)
635 if (inNumSamples) {
636 float a = DEMANDINPUT_A(0, inNumSamples);
637 float b = DEMANDINPUT_A(1, inNumSamples);
638 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : a + b;
639 } else {
640 RESETINPUT(0);
641 RESETINPUT(1);
645 void sub_d(BinaryOpUGen *unit, int inNumSamples)
647 if (inNumSamples) {
648 float a = DEMANDINPUT_A(0, inNumSamples);
649 float b = DEMANDINPUT_A(1, inNumSamples);
650 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : a - b;
651 } else {
652 RESETINPUT(0);
653 RESETINPUT(1);
657 void mul_d(BinaryOpUGen *unit, int inNumSamples)
659 if (inNumSamples) {
660 float a = DEMANDINPUT_A(0, inNumSamples);
661 float b = DEMANDINPUT_A(1, inNumSamples);
662 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : a * b;
663 } else {
664 RESETINPUT(0);
665 RESETINPUT(1);
669 void div_d(BinaryOpUGen *unit, int inNumSamples)
671 if (inNumSamples) {
672 float a = DEMANDINPUT_A(0, inNumSamples);
673 float b = DEMANDINPUT_A(1, inNumSamples);
674 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : a / b;
675 } else {
676 RESETINPUT(0);
677 RESETINPUT(1);
681 void mod_d(BinaryOpUGen *unit, int inNumSamples)
683 if (inNumSamples) {
684 float a = DEMANDINPUT_A(0, inNumSamples);
685 float b = DEMANDINPUT_A(1, inNumSamples);
686 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : sc_mod(a, b);
687 } else {
688 RESETINPUT(0);
689 RESETINPUT(1);
693 void max_d(BinaryOpUGen *unit, int inNumSamples)
695 if (inNumSamples) {
696 float a = DEMANDINPUT_A(0, inNumSamples);
697 float b = DEMANDINPUT_A(1, inNumSamples);
698 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : sc_max(a, b);
699 } else {
700 RESETINPUT(0);
701 RESETINPUT(1);
705 void min_d(BinaryOpUGen *unit, int inNumSamples)
707 if (inNumSamples) {
708 float a = DEMANDINPUT_A(0, inNumSamples);
709 float b = DEMANDINPUT_A(1, inNumSamples);
710 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : sc_min(a, b);
711 } else {
712 RESETINPUT(0);
713 RESETINPUT(1);
717 void and_d(BinaryOpUGen *unit, int inNumSamples)
719 if (inNumSamples) {
720 float a = DEMANDINPUT_A(0, inNumSamples);
721 float b = DEMANDINPUT_A(1, inNumSamples);
722 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : sc_andt(a, b);
723 } else {
724 RESETINPUT(0);
725 RESETINPUT(1);
729 void or_d(BinaryOpUGen *unit, int inNumSamples)
731 if (inNumSamples) {
732 float a = DEMANDINPUT_A(0, inNumSamples);
733 float b = DEMANDINPUT_A(1, inNumSamples);
734 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : sc_ort(a, b);
735 } else {
736 RESETINPUT(0);
737 RESETINPUT(1);
741 void xor_d(BinaryOpUGen *unit, int inNumSamples)
743 if (inNumSamples) {
744 float a = DEMANDINPUT_A(0, inNumSamples);
745 float b = DEMANDINPUT_A(1, inNumSamples);
746 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : sc_xort(a, b);
747 } else {
748 RESETINPUT(0);
749 RESETINPUT(1);
753 void rightShift_d(BinaryOpUGen *unit, int inNumSamples)
755 if (inNumSamples) {
756 float a = DEMANDINPUT_A(0, inNumSamples);
757 float b = DEMANDINPUT_A(1, inNumSamples);
758 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : sc_rst(a, b);
759 } else {
760 RESETINPUT(0);
761 RESETINPUT(1);
765 void leftShift_d(BinaryOpUGen *unit, int inNumSamples)
767 if (inNumSamples) {
768 float a = DEMANDINPUT_A(0, inNumSamples);
769 float b = DEMANDINPUT_A(1, inNumSamples);
770 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : sc_lst(a, b);
771 } else {
772 RESETINPUT(0);
773 RESETINPUT(1);
777 void amclip_d(BinaryOpUGen *unit, int inNumSamples)
779 if (inNumSamples) {
780 float a = DEMANDINPUT_A(0, inNumSamples);
781 float b = DEMANDINPUT_A(1, inNumSamples);
782 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : sc_amclip(a, b);
783 } else {
784 RESETINPUT(0);
785 RESETINPUT(1);
789 void scaleneg_d(BinaryOpUGen *unit, int inNumSamples)
791 if (inNumSamples) {
792 float a = DEMANDINPUT_A(0, inNumSamples);
793 float b = DEMANDINPUT_A(1, inNumSamples);
794 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : sc_scaleneg(a, b);
795 } else {
796 RESETINPUT(0);
797 RESETINPUT(1);
801 void pow_d(BinaryOpUGen *unit, int inNumSamples)
803 if (inNumSamples) {
804 float a = DEMANDINPUT_A(0, inNumSamples);
805 float b = DEMANDINPUT_A(1, inNumSamples);
806 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : (a < 0.f ? -pow(-a, b) : pow(a, b));
807 } else {
808 RESETINPUT(0);
809 RESETINPUT(1);
813 void ring1_d(BinaryOpUGen *unit, int inNumSamples)
815 if (inNumSamples) {
816 float a = DEMANDINPUT_A(0, inNumSamples);
817 float b = DEMANDINPUT_A(1, inNumSamples);
818 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : a * b + a;
819 } else {
820 RESETINPUT(0);
821 RESETINPUT(1);
825 void ring2_d(BinaryOpUGen *unit, int inNumSamples)
827 if (inNumSamples) {
828 float a = DEMANDINPUT_A(0, inNumSamples);
829 float b = DEMANDINPUT_A(1, inNumSamples);
830 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : a * b + a + b;
831 } else {
832 RESETINPUT(0);
833 RESETINPUT(1);
837 void ring3_d(BinaryOpUGen *unit, int inNumSamples)
839 if (inNumSamples) {
840 float a = DEMANDINPUT_A(0, inNumSamples);
841 float b = DEMANDINPUT_A(1, inNumSamples);
842 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : a * a * b;
843 } else {
844 RESETINPUT(0);
845 RESETINPUT(1);
849 void ring4_d(BinaryOpUGen *unit, int inNumSamples)
851 if (inNumSamples) {
852 float a = DEMANDINPUT_A(0, inNumSamples);
853 float b = DEMANDINPUT_A(1, inNumSamples);
854 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : a * a * b - a * b * b;
855 } else {
856 RESETINPUT(0);
857 RESETINPUT(1);
861 void thresh_d(BinaryOpUGen *unit, int inNumSamples)
863 if (inNumSamples) {
864 float a = DEMANDINPUT_A(0, inNumSamples);
865 float b = DEMANDINPUT_A(1, inNumSamples);
866 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : sc_thresh(a, b);
867 } else {
868 RESETINPUT(0);
869 RESETINPUT(1);
873 void clip2_d(BinaryOpUGen *unit, int inNumSamples)
875 if (inNumSamples) {
876 float a = DEMANDINPUT_A(0, inNumSamples);
877 float b = DEMANDINPUT_A(1, inNumSamples);
878 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : sc_clip2(a, b);
879 } else {
880 RESETINPUT(0);
881 RESETINPUT(1);
885 void excess_d(BinaryOpUGen *unit, int inNumSamples)
887 if (inNumSamples) {
888 float a = DEMANDINPUT_A(0, inNumSamples);
889 float b = DEMANDINPUT_A(1, inNumSamples);
890 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : sc_excess(a, b);
891 } else {
892 RESETINPUT(0);
893 RESETINPUT(1);
897 void lt_d(BinaryOpUGen *unit, int inNumSamples)
899 if (inNumSamples) {
900 float a = DEMANDINPUT_A(0, inNumSamples);
901 float b = DEMANDINPUT_A(1, inNumSamples);
902 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : (a < b ? 1.f : 0.f);
903 } else {
904 RESETINPUT(0);
905 RESETINPUT(1);
909 void gt_d(BinaryOpUGen *unit, int inNumSamples)
911 if (inNumSamples) {
912 float a = DEMANDINPUT_A(0, inNumSamples);
913 float b = DEMANDINPUT_A(1, inNumSamples);
914 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : (a > b ? 1.f : 0.f);
915 } else {
916 RESETINPUT(0);
917 RESETINPUT(1);
921 void le_d(BinaryOpUGen *unit, int inNumSamples)
923 if (inNumSamples) {
924 float a = DEMANDINPUT_A(0, inNumSamples);
925 float b = DEMANDINPUT_A(1, inNumSamples);
926 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : (a <= b ? 1.f : 0.f);
927 } else {
928 RESETINPUT(0);
929 RESETINPUT(1);
933 void ge_d(BinaryOpUGen *unit, int inNumSamples)
935 if (inNumSamples) {
936 float a = DEMANDINPUT_A(0, inNumSamples);
937 float b = DEMANDINPUT_A(1, inNumSamples);
938 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : (a >= b ? 1.f : 0.f);
939 } else {
940 RESETINPUT(0);
941 RESETINPUT(1);
945 void eq_d(BinaryOpUGen *unit, int inNumSamples)
947 if (inNumSamples) {
948 float a = DEMANDINPUT_A(0, inNumSamples);
949 float b = DEMANDINPUT_A(1, inNumSamples);
950 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : (a == b ? 1.f : 0.f);
951 } else {
952 RESETINPUT(0);
953 RESETINPUT(1);
957 void neq_d(BinaryOpUGen *unit, int inNumSamples)
959 if (inNumSamples) {
960 float a = DEMANDINPUT_A(0, inNumSamples);
961 float b = DEMANDINPUT_A(1, inNumSamples);
962 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : (a != b ? 1.f : 0.f);
963 } else {
964 RESETINPUT(0);
965 RESETINPUT(1);
969 void sumsqr_d(BinaryOpUGen *unit, int inNumSamples)
971 if (inNumSamples) {
972 float a = DEMANDINPUT_A(0, inNumSamples);
973 float b = DEMANDINPUT_A(1, inNumSamples);
974 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : a * a + b * b;
975 } else {
976 RESETINPUT(0);
977 RESETINPUT(1);
981 void difsqr_d(BinaryOpUGen *unit, int inNumSamples)
983 if (inNumSamples) {
984 float a = DEMANDINPUT_A(0, inNumSamples);
985 float b = DEMANDINPUT_A(1, inNumSamples);
986 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : a * a - b * b;
987 } else {
988 RESETINPUT(0);
989 RESETINPUT(1);
993 void sqrsum_d(BinaryOpUGen *unit, int inNumSamples)
995 if (inNumSamples) {
996 float a = DEMANDINPUT_A(0, inNumSamples);
997 float b = DEMANDINPUT_A(1, inNumSamples);
998 float z;
999 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : (z = a + b, z * z);
1000 } else {
1001 RESETINPUT(0);
1002 RESETINPUT(1);
1006 void sqrdif_d(BinaryOpUGen *unit, int inNumSamples)
1008 if (inNumSamples) {
1009 float a = DEMANDINPUT_A(0, inNumSamples);
1010 float b = DEMANDINPUT_A(1, inNumSamples);
1011 float z;
1012 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : (z = a - b, z * z);
1013 } else {
1014 RESETINPUT(0);
1015 RESETINPUT(1);
1019 void absdif_d(BinaryOpUGen *unit, int inNumSamples)
1021 if (inNumSamples) {
1022 float a = DEMANDINPUT_A(0, inNumSamples);
1023 float b = DEMANDINPUT_A(1, inNumSamples);
1024 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : fabs(a - b);
1025 } else {
1026 RESETINPUT(0);
1027 RESETINPUT(1);
1031 void round_d(BinaryOpUGen *unit, int inNumSamples)
1033 if (inNumSamples) {
1034 float a = DEMANDINPUT_A(0, inNumSamples);
1035 float b = DEMANDINPUT_A(1, inNumSamples);
1036 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : sc_round(a, b);
1037 } else {
1038 RESETINPUT(0);
1039 RESETINPUT(1);
1043 void roundUp_d(BinaryOpUGen *unit, int inNumSamples)
1045 if (inNumSamples) {
1046 float a = DEMANDINPUT_A(0, inNumSamples);
1047 float b = DEMANDINPUT_A(1, inNumSamples);
1048 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : sc_roundUp(a, b);
1049 } else {
1050 RESETINPUT(0);
1051 RESETINPUT(1);
1055 void trunc_d(BinaryOpUGen *unit, int inNumSamples)
1057 if (inNumSamples) {
1058 float a = DEMANDINPUT_A(0, inNumSamples);
1059 float b = DEMANDINPUT_A(1, inNumSamples);
1060 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : sc_trunc(a, b);
1061 } else {
1062 RESETINPUT(0);
1063 RESETINPUT(1);
1067 void fold2_d(BinaryOpUGen *unit, int inNumSamples)
1069 if (inNumSamples) {
1070 float a = DEMANDINPUT_A(0, inNumSamples);
1071 float b = DEMANDINPUT_A(1, inNumSamples);
1072 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : sc_fold2(a, b);
1073 } else {
1074 RESETINPUT(0);
1075 RESETINPUT(1);
1079 void wrap2_d(BinaryOpUGen *unit, int inNumSamples)
1081 if (inNumSamples) {
1082 float a = DEMANDINPUT_A(0, inNumSamples);
1083 float b = DEMANDINPUT_A(1, inNumSamples);
1084 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : sc_wrap2(a, b);
1085 } else {
1086 RESETINPUT(0);
1087 RESETINPUT(1);
1091 void atan2_d(BinaryOpUGen *unit, int inNumSamples)
1093 if (inNumSamples) {
1094 float a = DEMANDINPUT_A(0, inNumSamples);
1095 float b = DEMANDINPUT_A(1, inNumSamples);
1096 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : atan2(a, b);
1097 } else {
1098 RESETINPUT(0);
1099 RESETINPUT(1);
1103 void hypot_d(BinaryOpUGen *unit, int inNumSamples)
1105 if (inNumSamples) {
1106 float a = DEMANDINPUT_A(0, inNumSamples);
1107 float b = DEMANDINPUT_A(1, inNumSamples);
1108 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : hypot(a, b);
1109 } else {
1110 RESETINPUT(0);
1111 RESETINPUT(1);
1115 void hypotx_d(BinaryOpUGen *unit, int inNumSamples)
1117 if (inNumSamples) {
1118 float a = DEMANDINPUT_A(0, inNumSamples);
1119 float b = DEMANDINPUT_A(1, inNumSamples);
1120 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : sc_hypotx(a, b);
1121 } else {
1122 RESETINPUT(0);
1123 RESETINPUT(1);
1129 void zero_1(BinaryOpUGen *unit, int inNumSamples)
1131 ZOUT0(0) = 0.f;
1134 void firstarg_1(BinaryOpUGen *unit, int inNumSamples)
1136 ZOUT0(0) = ZIN0(0);
1139 void secondarg_1(BinaryOpUGen *unit, int inNumSamples)
1141 ZOUT0(0) = ZIN0(1);
1144 void add_1(BinaryOpUGen *unit, int inNumSamples)
1146 ZOUT0(0) = ZIN0(0) + ZIN0(1);
1149 void sub_1(BinaryOpUGen *unit, int inNumSamples)
1151 ZOUT0(0) = ZIN0(0) - ZIN0(1);
1154 void mul_1(BinaryOpUGen *unit, int inNumSamples)
1156 ZOUT0(0) = ZIN0(0) * ZIN0(1);
1159 void div_1(BinaryOpUGen *unit, int inNumSamples)
1161 ZOUT0(0) = ZIN0(0) / ZIN0(1);
1164 void mod_1(BinaryOpUGen *unit, int inNumSamples)
1166 float xa = ZIN0(0);
1167 float xb = ZIN0(1);
1168 ZOUT0(0) = sc_mod(xa, xb);
1171 void max_1(BinaryOpUGen *unit, int inNumSamples)
1173 float xa = ZIN0(0);
1174 float xb = ZIN0(1);
1175 ZOUT0(0) = sc_max(xa, xb);
1178 void min_1(BinaryOpUGen *unit, int inNumSamples)
1180 float xa = ZIN0(0);
1181 float xb = ZIN0(1);
1182 ZOUT0(0) = sc_min(xa, xb);
1185 void and_1(BinaryOpUGen *unit, int inNumSamples)
1187 float xa = ZIN0(0);
1188 float xb = ZIN0(1);
1189 ZOUT0(0) = sc_andt(xa, xb);
1192 void or_1(BinaryOpUGen *unit, int inNumSamples)
1194 float xa = ZIN0(0);
1195 float xb = ZIN0(1);
1196 ZOUT0(0) = sc_ort(xa, xb);
1199 void xor_1(BinaryOpUGen *unit, int inNumSamples)
1201 float xa = ZIN0(0);
1202 float xb = ZIN0(1);
1203 ZOUT0(0) = sc_xort(xa, xb);
1206 void rightShift_1(BinaryOpUGen *unit, int inNumSamples)
1208 float xa = ZIN0(0);
1209 float xb = ZIN0(1);
1210 ZOUT0(0) = sc_rst(xa, xb);
1213 void leftShift_1(BinaryOpUGen *unit, int inNumSamples)
1215 float xa = ZIN0(0);
1216 float xb = ZIN0(1);
1217 ZOUT0(0) = sc_lst(xa, xb);
1220 void amclip_1(BinaryOpUGen *unit, int inNumSamples)
1222 float xa = ZIN0(0);
1223 float xb = ZIN0(1);
1224 ZOUT0(0) = sc_amclip(xa, xb);
1227 void scaleneg_1(BinaryOpUGen *unit, int inNumSamples)
1229 float xa = ZIN0(0);
1230 float xb = ZIN0(1);
1231 ZOUT0(0) = xa >= 0.f ? xa : xa * xb;
1234 void pow_1(BinaryOpUGen *unit, int inNumSamples)
1236 float xa = ZIN0(0);
1237 float xb = ZIN0(1);
1238 ZOUT0(0) = xa >= 0.f ? pow(xa, xb) : -pow(-xa, xb);
1242 void ring1_1(BinaryOpUGen *unit, int inNumSamples)
1244 float xa = ZIN0(0);
1245 float xb = ZIN0(1);
1246 ZOUT0(0) = xa * xb + xa;
1249 void ring2_1(BinaryOpUGen *unit, int inNumSamples)
1251 float xa = ZIN0(0);
1252 float xb = ZIN0(1);
1253 ZOUT0(0) = xa * xb + xa + xb;
1256 void ring3_1(BinaryOpUGen *unit, int inNumSamples)
1258 float xa = ZIN0(0);
1259 float xb = ZIN0(1);
1260 ZOUT0(0) = xa * xa * xb;
1263 void ring4_1(BinaryOpUGen *unit, int inNumSamples)
1265 float xa = ZIN0(0);
1266 float xb = ZIN0(1);
1267 ZOUT0(0) = xa * xa * xb - xa * xb * xb;
1270 void thresh_1(BinaryOpUGen *unit, int inNumSamples)
1272 float xa = ZIN0(0);
1273 float xb = ZIN0(1);
1274 ZOUT0(0) = xa < xb ? 0.f : xa;
1277 void clip2_1(BinaryOpUGen *unit, int inNumSamples)
1279 float xa = ZIN0(0);
1280 float xb = ZIN0(1);
1281 ZOUT0(0) = xa > xb ? xb : (xa < -xb ? -xb : xa);
1284 void excess_1(BinaryOpUGen *unit, int inNumSamples)
1286 float xa = ZIN0(0);
1287 float xb = ZIN0(1);
1288 ZOUT0(0) = xa > xb ? xa-xb : (xa < -xb ? xa+xb : 0.f);
1291 void lt_1(BinaryOpUGen *unit, int inNumSamples)
1293 float xa = ZIN0(0);
1294 float xb = ZIN0(1);
1295 ZOUT0(0) = xa < xb ? 1.f : 0.f;
1298 void le_1(BinaryOpUGen *unit, int inNumSamples)
1300 float xa = ZIN0(0);
1301 float xb = ZIN0(1);
1302 ZOUT0(0) = xa <= xb ? 1.f : 0.f;
1305 void gt_1(BinaryOpUGen *unit, int inNumSamples)
1307 float xa = ZIN0(0);
1308 float xb = ZIN0(1);
1309 ZOUT0(0) = xa > xb ? 1.f : 0.f;
1312 void ge_1(BinaryOpUGen *unit, int inNumSamples)
1314 float xa = ZIN0(0);
1315 float xb = ZIN0(1);
1316 ZOUT0(0) = xa >= xb ? 1.f : 0.f;
1319 void eq_1(BinaryOpUGen *unit, int inNumSamples)
1321 float xa = ZIN0(0);
1322 float xb = ZIN0(1);
1323 ZOUT0(0) = xa == xb ? 1.f : 0.f;
1326 void neq_1(BinaryOpUGen *unit, int inNumSamples)
1328 float xa = ZIN0(0);
1329 float xb = ZIN0(1);
1330 ZOUT0(0) = xa != xb ? 1.f : 0.f;
1334 void sumsqr_1(BinaryOpUGen *unit, int inNumSamples)
1336 float xa = ZIN0(0);
1337 float xb = ZIN0(1);
1338 ZOUT0(0) = xa * xa + xb * xb;
1341 void difsqr_1(BinaryOpUGen *unit, int inNumSamples)
1343 float xa = ZIN0(0);
1344 float xb = ZIN0(1);
1345 ZOUT0(0) = xa * xa - xb * xb;
1348 void sqrsum_1(BinaryOpUGen *unit, int inNumSamples)
1350 float xa = ZIN0(0);
1351 float xb = ZIN0(1);
1352 float sum = xa + xb;
1353 ZOUT0(0) = sum * sum;
1356 void sqrdif_1(BinaryOpUGen *unit, int inNumSamples)
1358 float xa = ZIN0(0);
1359 float xb = ZIN0(1);
1360 float dif = xa - xb;
1361 ZOUT0(0) = dif * dif;
1364 void absdif_1(BinaryOpUGen *unit, int inNumSamples)
1366 float xa = ZIN0(0);
1367 float xb = ZIN0(1);
1368 ZOUT0(0) = fabs(xa - xb);
1371 void round_1(BinaryOpUGen *unit, int inNumSamples)
1373 float xa = ZIN0(0);
1374 float xb = ZIN0(1);
1375 ZOUT0(0) = sc_round(xa, xb);
1378 void roundUp_1(BinaryOpUGen *unit, int inNumSamples)
1380 float xa = ZIN0(0);
1381 float xb = ZIN0(1);
1382 ZOUT0(0) = sc_roundUp(xa, xb);
1385 void trunc_1(BinaryOpUGen *unit, int inNumSamples)
1387 float xa = ZIN0(0);
1388 float xb = ZIN0(1);
1389 ZOUT0(0) = sc_trunc(xa, xb);
1392 void fold2_1(BinaryOpUGen *unit, int inNumSamples)
1394 float xa = ZIN0(0);
1395 float xb = ZIN0(1);
1396 ZOUT0(0) = sc_fold(xa, -xb, xb);
1399 void wrap2_1(BinaryOpUGen *unit, int inNumSamples)
1401 float xa = ZIN0(0);
1402 float xb = ZIN0(1);
1403 ZOUT0(0) = sc_wrap(xa, -xb, xb);
1406 void atan2_1(BinaryOpUGen *unit, int inNumSamples)
1408 float xa = ZIN0(0);
1409 float xb = ZIN0(1);
1410 ZOUT0(0) = atan2(xa, xb);
1413 void hypot_1(BinaryOpUGen *unit, int inNumSamples)
1415 float xa = ZIN0(0);
1416 float xb = ZIN0(1);
1417 ZOUT0(0) = hypot(xa, xb);
1420 void hypotx_1(BinaryOpUGen *unit, int inNumSamples)
1422 float xa = ZIN0(0);
1423 float xb = ZIN0(1);
1424 ZOUT0(0) = sc_hypotx(xa, xb);
1429 void zero_aa(BinaryOpUGen *unit, int inNumSamples)
1431 float *out = OUT(0);
1433 ZClear(inNumSamples, out);
1436 void firstarg_aa(BinaryOpUGen *unit, int inNumSamples)
1438 float *out = OUT(0);
1439 float *a = IN(0);
1441 ZCopy(inNumSamples, out, a);
1444 #ifdef NOVA_SIMD
1445 inline_functions void firstarg_aa_nova(BinaryOpUGen *unit, int inNumSamples)
1447 nova::copyvec_simd(OUT(0), IN(0), inNumSamples);
1449 #endif
1451 void secondarg_aa(BinaryOpUGen *unit, int inNumSamples)
1453 float *out = OUT(0);
1454 float *b = IN(1);
1456 ZCopy(inNumSamples, out, b);
1459 #ifdef NOVA_SIMD
1460 inline_functions void secondarg_aa_nova(BinaryOpUGen *unit, int inNumSamples)
1462 nova::copyvec_simd(OUT(0), IN(1), inNumSamples);
1464 #endif
1466 void add_aa(BinaryOpUGen *unit, int inNumSamples)
1468 float *out = ZOUT(0);
1469 float *a = ZIN(0);
1470 float *b = ZIN(1);
1472 LOOP1(inNumSamples,
1473 ZXP(out) = ZXP(a) + ZXP(b);
1477 void add_ak(BinaryOpUGen *unit, int inNumSamples)
1479 float *out = ZOUT(0);
1480 float *a = ZIN(0);
1481 float xb = unit->mPrevB;
1482 float next_b = ZIN0(1);
1484 if (xb == next_b) {
1485 if (xb == 0.f) {
1486 ZCopy(inNumSamples, out, a);
1487 } else {
1488 float *out = ZOUT(0);
1489 float *a = ZIN(0);
1490 LOOP1(inNumSamples,
1491 ZXP(out) = ZXP(a) + xb;
1494 } else {
1495 float slope = CALCSLOPE(next_b, xb);
1496 LOOP1(inNumSamples,
1497 ZXP(out) = ZXP(a) + xb;
1498 xb += slope;
1500 unit->mPrevB = xb;
1505 void add_ka(BinaryOpUGen *unit, int inNumSamples)
1507 float *out = ZOUT(0);
1508 float xa = unit->mPrevA;
1509 float *b = ZIN(1);
1510 float next_a = ZIN0(0);
1512 if (xa == next_a) {
1513 if (xa == 0.f) {
1514 ZCopy(inNumSamples, out, b);
1515 } else {
1516 LOOP1(inNumSamples,
1517 ZXP(out) = xa + ZXP(b);
1520 } else {
1521 float slope = CALCSLOPE(next_a, xa);
1522 LOOP1(inNumSamples,
1523 ZXP(out) = xa + ZXP(b);
1524 xa += slope;
1526 unit->mPrevA = xa;
1530 void add_ia(BinaryOpUGen *unit, int inNumSamples)
1532 float *out = ZOUT(0);
1533 float xa = ZIN0(0);
1534 float *b = ZIN(1);
1536 LOOP1(inNumSamples,
1537 ZXP(out) = xa + ZXP(b);
1539 unit->mPrevA = xa;
1542 void add_ai(BinaryOpUGen *unit, int inNumSamples)
1544 float *out = ZOUT(0);
1545 float *a = ZIN(0);
1546 float xb = ZIN0(1);
1548 LOOP1(inNumSamples,
1549 ZXP(out) = ZXP(a) + xb;
1551 unit->mPrevB = xb;
1554 #ifdef NOVA_SIMD
1555 NOVA_BINARY_WRAPPER(add, plus)
1557 inline_functions void add_ak_nova(BinaryOpUGen *unit, int inNumSamples)
1559 float xb = unit->mPrevB;
1560 float next_b = ZIN0(1);
1562 if (xb == next_b) {
1563 if (xb == 0.f)
1564 nova::copyvec_simd(OUT(0), IN(0), inNumSamples);
1565 else
1566 nova::plus_vec_simd(OUT(0), IN(0), xb, inNumSamples);
1567 } else {
1568 float slope = CALCSLOPE(next_b, xb);
1569 nova::plus_vec_simd(OUT(0), IN(0), slope_argument(xb, slope), inNumSamples);
1570 unit->mPrevB = next_b;
1574 inline_functions void add_ak_nova_64(BinaryOpUGen *unit, int inNumSamples)
1576 float xb = unit->mPrevB;
1577 float next_b = ZIN0(1);
1579 if (xb == next_b) {
1580 if (xb == 0.f)
1581 nova::copyvec_simd<64>(OUT(0), IN(0));
1582 else
1583 nova::plus_vec_simd<64>(OUT(0), IN(0), xb);
1584 } else {
1585 float slope = CALCSLOPE(next_b, xb);
1586 nova::plus_vec_simd(OUT(0), IN(0), slope_argument(xb, slope), inNumSamples);
1587 unit->mPrevB = next_b;
1592 inline_functions void add_ka_nova(BinaryOpUGen *unit, int inNumSamples)
1594 float xa = unit->mPrevA;
1595 float next_a = ZIN0(0);
1597 if (xa == next_a) {
1598 if (xa == 0.f)
1599 nova::copyvec_simd(OUT(0), IN(1), inNumSamples);
1600 else
1601 nova::plus_vec_simd(OUT(0), IN(1), xa, inNumSamples);
1602 } else {
1603 float slope = CALCSLOPE(next_a, xa);
1604 nova::plus_vec_simd(OUT(0), IN(1), slope_argument(xa, slope), inNumSamples);
1605 unit->mPrevA = next_a;
1609 inline_functions void add_ka_nova_64(BinaryOpUGen *unit, int inNumSamples)
1611 float xa = unit->mPrevA;
1612 float next_a = ZIN0(0);
1614 if (xa == next_a) {
1615 if (xa == 0.f)
1616 nova::copyvec_simd<64>(OUT(0), IN(1));
1617 else
1618 nova::plus_vec_simd<64>(OUT(0), IN(1), xa);
1619 } else {
1620 float slope = CALCSLOPE(next_a, xa);
1621 nova::plus_vec_simd(OUT(0), IN(1), slope_argument(xa, slope), inNumSamples);
1622 unit->mPrevA = next_a;
1626 #endif
1630 /////////////////////////
1634 void sub_aa(BinaryOpUGen *unit, int inNumSamples)
1636 float *out = ZOUT(0);
1637 float *a = ZIN(0);
1638 float *b = ZIN(1);
1640 LOOP1(inNumSamples,
1641 ZXP(out) = ZXP(a) - ZXP(b);
1645 void sub_ak(BinaryOpUGen *unit, int inNumSamples)
1647 float *out = ZOUT(0);
1648 float *a = ZIN(0);
1649 float xb = unit->mPrevB;
1650 float next_b = ZIN0(1);
1652 if (xb == next_b) {
1653 if (xb == 0.f) {
1654 ZCopy(inNumSamples, out, a);
1655 } else {
1656 LOOP1(inNumSamples,
1657 ZXP(out) = ZXP(a) - xb;
1660 } else {
1661 float slope = CALCSLOPE(next_b, xb);
1662 LOOP1(inNumSamples,
1663 ZXP(out) = ZXP(a) - xb;
1664 xb += slope;
1666 unit->mPrevB = xb;
1670 void sub_ka(BinaryOpUGen *unit, int inNumSamples)
1672 float *out = ZOUT(0);
1673 float xa = unit->mPrevA;
1674 float *b = ZIN(1);
1675 float next_a = ZIN0(0);
1677 if (xa == next_a) {
1678 if (xa == 0.f) {
1679 ZCopy(inNumSamples, out, b);
1680 } else {
1681 LOOP1(inNumSamples,
1682 ZXP(out) = xa - ZXP(b);
1685 } else {
1686 float slope = CALCSLOPE(next_a, xa);
1687 LOOP1(inNumSamples,
1688 ZXP(out) = xa - ZXP(b);
1689 xa += slope;
1691 unit->mPrevA = xa;
1696 void sub_ia(BinaryOpUGen *unit, int inNumSamples)
1698 float *out = ZOUT(0);
1699 float xa = ZIN0(0);
1700 float *b = ZIN(1);
1702 LOOP1(inNumSamples,
1703 ZXP(out) = xa - ZXP(b);
1705 unit->mPrevA = xa;
1708 void sub_ai(BinaryOpUGen *unit, int inNumSamples)
1710 float *out = ZOUT(0);
1711 float *a = ZIN(0);
1712 float xb = ZIN0(1);
1714 LOOP1(inNumSamples,
1715 ZXP(out) = ZXP(a) - xb;
1717 unit->mPrevB = xb;
1720 #ifdef NOVA_SIMD
1721 NOVA_BINARY_WRAPPER(sub, minus)
1723 inline_functions void sub_ak_nova(BinaryOpUGen *unit, int inNumSamples)
1725 float xb = unit->mPrevB;
1726 float next_b = ZIN0(1);
1728 if (xb == next_b) {
1729 if (xb == 0.f)
1730 nova::copyvec_simd(OUT(0), IN(0), inNumSamples);
1731 else
1732 nova::minus_vec_simd(OUT(0), IN(0), xb, inNumSamples);
1733 } else {
1734 float slope = CALCSLOPE(next_b, xb);
1735 nova::minus_vec_simd(OUT(0), IN(0), slope_argument(xb, slope), inNumSamples);
1736 unit->mPrevB = next_b;
1740 inline_functions void sub_ak_nova_64(BinaryOpUGen *unit, int inNumSamples)
1742 float xb = unit->mPrevB;
1743 float next_b = ZIN0(1);
1745 if (xb == next_b) {
1746 if (xb == 0.f)
1747 nova::copyvec_aa_simd<64>(OUT(0), IN(0));
1748 else
1749 nova::minus_vec_simd<64>(OUT(0), IN(0), xb);
1750 } else {
1751 float slope = CALCSLOPE(next_b, xb);
1752 nova::minus_vec_simd(OUT(0), IN(0), slope_argument(xb, slope), inNumSamples);
1753 unit->mPrevB = next_b;
1757 inline_functions void sub_ka_nova(BinaryOpUGen *unit, int inNumSamples)
1759 float xa = unit->mPrevA;
1760 float next_a = ZIN0(0);
1762 if (xa == next_a) {
1763 if (xa == 0.f)
1764 nova::copyvec_simd(OUT(0), IN(1), inNumSamples);
1765 else
1766 nova::minus_vec_simd(OUT(0), xa, IN(1), inNumSamples);
1767 } else {
1768 float slope = CALCSLOPE(next_a, xa);
1769 nova::minus_vec_simd(OUT(0), slope_argument(xa, slope), IN(1), inNumSamples);
1770 unit->mPrevA = next_a;
1774 inline_functions void sub_ka_nova_64(BinaryOpUGen *unit, int inNumSamples)
1776 float xa = unit->mPrevA;
1777 float next_a = ZIN0(0);
1779 if (xa == next_a) {
1780 if (xa == 0.f)
1781 nova::copyvec_simd<64>(OUT(0), IN(1));
1782 else
1783 nova::minus_vec_simd<64>(OUT(0), xa, IN(1));
1784 } else {
1785 float slope = CALCSLOPE(next_a, xa);
1786 nova::minus_vec_simd(OUT(0), slope_argument(xa, slope), IN(1), inNumSamples);
1787 unit->mPrevA = next_a;
1791 #endif
1795 void mul_aa(BinaryOpUGen *unit, int inNumSamples)
1797 float *out = ZOUT(0);
1798 float *a = ZIN(0);
1799 float *b = ZIN(1);
1801 LOOP1(inNumSamples,
1802 ZXP(out) = ZXP(a) * ZXP(b);
1806 void mul_ak(BinaryOpUGen *unit, int inNumSamples)
1808 float *out = ZOUT(0);
1809 float *a = ZIN(0);
1810 float xb = unit->mPrevB;
1811 float next_b = ZIN0(1);
1813 if (xb == next_b) {
1814 if (xb == 0.f) {
1815 ZClear(inNumSamples, out);
1816 } else if (xb == 1.f) {
1817 ZCopy(inNumSamples, out, a);
1818 } else {
1819 LOOP1(inNumSamples,
1820 ZXP(out) = ZXP(a) * xb;
1823 } else {
1824 float slope = CALCSLOPE(next_b, xb);
1825 LOOP1(inNumSamples,
1826 ZXP(out) = ZXP(a) * xb;
1827 xb += slope;
1829 unit->mPrevB = xb;
1833 void mul_ka(BinaryOpUGen *unit, int inNumSamples)
1835 float *out = ZOUT(0);
1836 float xa = unit->mPrevA;
1837 float *b = ZIN(1);
1838 float next_a = ZIN0(0);
1840 if (xa == next_a) {
1841 if (xa == 0.f) {
1842 ZClear(inNumSamples, out);
1843 } else if (xa == 1.f) {
1844 ZCopy(inNumSamples, out, b);
1845 } else {
1846 LOOP1(inNumSamples,
1847 ZXP(out) = xa * ZXP(b);
1850 } else {
1851 float slope = CALCSLOPE(next_a, xa);
1852 LOOP1(inNumSamples,
1853 ZXP(out) = xa * ZXP(b);
1854 xa += slope;
1856 unit->mPrevA = xa;
1861 void mul_ai(BinaryOpUGen *unit, int inNumSamples)
1863 float *out = ZOUT(0);
1864 float *a = ZIN(0);
1865 float xb = ZIN0(1);
1867 LOOP1(inNumSamples,
1868 ZXP(out) = ZXP(a) * xb;
1870 unit->mPrevB = xb;
1873 void mul_ia(BinaryOpUGen *unit, int inNumSamples)
1875 float *out = ZOUT(0);
1876 float xa = ZIN0(0);
1877 float *b = ZIN(1);
1879 LOOP1(inNumSamples,
1880 ZXP(out) = xa * ZXP(b);
1882 unit->mPrevA = xa;
1885 #ifdef NOVA_SIMD
1886 NOVA_BINARY_WRAPPER(mul, times)
1888 inline_functions void mul_ka_nova(BinaryOpUGen *unit, int inNumSamples)
1890 float xa = unit->mPrevA;
1891 float next_a = ZIN0(0);
1893 if (xa == next_a) {
1894 if (xa == 0.f)
1895 nova::zerovec_simd(OUT(0), inNumSamples);
1896 else if (xa == 1.f)
1897 nova::copyvec_simd(OUT(0), IN(1), inNumSamples);
1898 else
1899 nova::times_vec_simd(OUT(0), IN(1), xa, inNumSamples);
1900 } else {
1901 float slope = CALCSLOPE(next_a, xa);
1902 unit->mPrevA = next_a;
1904 nova::times_vec_simd(OUT(0), IN(1), slope_argument(xa, slope), inNumSamples);
1908 inline_functions void mul_ka_nova_64(BinaryOpUGen *unit, int inNumSamples)
1910 float xa = unit->mPrevA;
1911 float next_a = ZIN0(0);
1913 if (xa == next_a) {
1914 if (xa == 0.f)
1915 nova::zerovec_simd<64>(OUT(0));
1916 else if (xa == 1.f)
1917 nova::copyvec_simd<64>(OUT(0), IN(1));
1918 else
1919 nova::times_vec_simd<64>(OUT(0), IN(1), xa);
1920 } else {
1921 float slope = CALCSLOPE(next_a, xa);
1922 unit->mPrevA = next_a;
1924 nova::times_vec_simd(OUT(0), IN(1), slope_argument(xa, slope), inNumSamples);
1928 inline_functions void mul_ak_nova(BinaryOpUGen *unit, int inNumSamples)
1930 float xb = unit->mPrevB;
1931 float next_b = ZIN0(1);
1933 if (xb == next_b) {
1934 if (xb == 0.f)
1935 nova::zerovec_simd(OUT(0), inNumSamples);
1936 else if (xb == 1.f)
1937 nova::copyvec_simd(OUT(0), IN(0), inNumSamples);
1938 else
1939 nova::times_vec_simd(OUT(0), IN(0), xb, inNumSamples);
1940 } else {
1941 float slope = CALCSLOPE(next_b, xb);
1942 unit->mPrevB = next_b;
1944 nova::times_vec_simd(OUT(0), IN(0), slope_argument(xb, slope), inNumSamples);
1948 inline_functions void mul_ak_nova_64(BinaryOpUGen *unit, int inNumSamples)
1950 float xb = unit->mPrevB;
1951 float next_b = ZIN0(1);
1953 if (xb == next_b) {
1954 if (xb == 0.f)
1955 nova::zerovec_simd<64>(OUT(0));
1956 else if (xb == 1.f)
1957 nova::copyvec_simd<64>(OUT(0), IN(0));
1958 else
1959 nova::times_vec_simd<64>(OUT(0), IN(0), xb);
1960 } else {
1961 float slope = CALCSLOPE(next_b, xb);
1962 unit->mPrevB = next_b;
1964 nova::times_vec_simd(OUT(0), IN(0), slope_argument(xb, slope), inNumSamples);
1968 #endif
1971 void div_aa(BinaryOpUGen *unit, int inNumSamples)
1973 float *out = ZOUT(0);
1974 float *a = ZIN(0);
1975 float *b = ZIN(1);
1977 LOOP1(inNumSamples,
1978 ZXP(out) = ZXP(a) / ZXP(b);
1982 void div_ak(BinaryOpUGen *unit, int inNumSamples)
1984 float *out = ZOUT(0);
1985 float *a = ZIN(0);
1986 float xb = unit->mPrevB;
1987 float next_b = ZIN0(1);
1989 if (xb == next_b) {
1990 if (xb == 0.f) {
1991 ZClear(inNumSamples, out);
1992 } else if (xb == 1.f) {
1993 ZCopy(inNumSamples, out, a);
1994 } else {
1995 float recip = 1.f / xb;
1996 LOOP1(inNumSamples,
1997 ZXP(out) = ZXP(a) * recip;
2000 } else {
2001 float slope = CALCSLOPE(next_b, xb);
2002 LOOP1(inNumSamples,
2003 ZXP(out) = ZXP(a) / xb;
2004 xb += slope;
2006 unit->mPrevB = xb;
2010 void div_ka(BinaryOpUGen *unit, int inNumSamples)
2012 float *out = ZOUT(0);
2013 float xa = unit->mPrevA;
2014 float *b = ZIN(1);
2015 float next_a = ZIN0(0);
2017 if (xa == next_a) {
2018 if (xa == 0.f) {
2019 ZClear(inNumSamples, out);
2020 } else {
2021 LOOP1(inNumSamples,
2022 ZXP(out) = xa / ZXP(b);
2025 } else {
2026 float slope = CALCSLOPE(next_a, xa);
2027 LOOP1(inNumSamples,
2028 ZXP(out) = xa / ZXP(b);
2029 xa += slope;
2031 unit->mPrevA = xa;
2035 void div_ia(BinaryOpUGen *unit, int inNumSamples)
2037 float *out = ZOUT(0);
2038 float xa = ZIN0(0);
2039 float *b = ZIN(1);
2041 LOOP1(inNumSamples,
2042 ZXP(out) = xa / ZXP(b);
2044 unit->mPrevA = xa;
2048 void div_ai(BinaryOpUGen *unit, int inNumSamples)
2050 float *out = ZOUT(0);
2051 float *a = ZIN(0);
2052 float xb = ZIN0(1);
2054 float rxb = 1.f / xb;
2055 LOOP1(inNumSamples,
2056 ZXP(out) = ZXP(a) * rxb;
2058 unit->mPrevB = xb;
2061 #ifdef NOVA_SIMD
2062 inline_functions void div_aa_nova(BinaryOpUGen *unit, int inNumSamples)
2064 nova::over_vec_simd(OUT(0), IN(0), IN(1), inNumSamples);
2067 inline_functions void div_ia_nova(BinaryOpUGen *unit, int inNumSamples)
2069 float xa = ZIN0(0);
2071 nova::over_vec_simd(OUT(0), xa, IN(1), inNumSamples);
2072 unit->mPrevA = xa;
2075 inline_functions void div_ai_nova(BinaryOpUGen *unit, int inNumSamples)
2077 float xb = ZIN0(1);
2079 nova::times_vec_simd(OUT(0), IN(0), 1.f/xb, inNumSamples);
2080 unit->mPrevB = xb;
2083 inline_functions void div_ak_nova(BinaryOpUGen *unit, int inNumSamples)
2085 float xb = unit->mPrevB;
2086 float next_b = ZIN0(1);
2088 if (xb == next_b) {
2089 if (xb == 0.f)
2090 nova::zerovec_simd(OUT(0), inNumSamples);
2091 else if (xb == 1.f)
2092 nova::copyvec_simd(OUT(0), IN(0), inNumSamples);
2093 else {
2094 float recip = 1.f / xb;
2095 nova::times_vec_simd(OUT(0), IN(0), recip, inNumSamples);
2097 } else {
2098 float slope = CALCSLOPE(next_b, xb);
2099 nova::over_vec_simd(OUT(0), IN(0), slope_argument(xb, slope), inNumSamples);
2100 unit->mPrevB = next_b;
2104 inline_functions void div_ka_nova(BinaryOpUGen *unit, int inNumSamples)
2106 float xa = unit->mPrevA;
2107 float next_a = ZIN0(0);
2109 if (xa == next_a) {
2110 if (xa == 0.f)
2111 nova::zerovec_simd(OUT(0), inNumSamples);
2112 else
2113 nova::over_vec_simd(OUT(0), xa, IN(1), inNumSamples);
2114 } else {
2115 float slope = CALCSLOPE(next_a, xa);
2116 nova::over_vec_simd(OUT(0), slope_argument(xa, slope), IN(1), inNumSamples);
2117 unit->mPrevA = xa;
2121 #endif
2127 void mod_aa(BinaryOpUGen *unit, int inNumSamples)
2129 float *out = ZOUT(0);
2130 float *a = ZIN(0);
2131 float *b = ZIN(1);
2133 LOOP1(inNumSamples,
2134 float xa = ZXP(a);
2135 float xb = ZXP(b);
2136 ZXP(out) = sc_mod(xa, xb);
2140 void mod_ak(BinaryOpUGen *unit, int inNumSamples)
2142 float *out = ZOUT(0);
2143 float *a = ZIN(0);
2144 float xb = unit->mPrevB;
2145 float next_b = ZIN0(1);
2147 if (xb == next_b) {
2148 if (xb == 0.f) {
2149 ZCopy(inNumSamples, out, a);
2150 } else {
2151 LOOP1(inNumSamples,
2152 ZXP(out) = sc_mod(ZXP(a), xb);
2155 } else {
2156 float slope = CALCSLOPE(next_b, xb);
2157 LOOP1(inNumSamples,
2158 ZXP(out) = sc_mod(ZXP(a), xb);
2159 xb += slope;
2161 unit->mPrevB = xb;
2165 void mod_ka(BinaryOpUGen *unit, int inNumSamples)
2167 float *out = ZOUT(0);
2168 float xa = unit->mPrevA;
2169 float *b = ZIN(1);
2170 float next_a = ZIN0(0);
2172 if (xa == next_a) {
2173 if (xa == 0.f) {
2174 ZClear(inNumSamples, out);
2175 } else {
2176 LOOP1(inNumSamples,
2177 ZXP(out) = sc_mod(xa, ZXP(b));
2180 } else {
2181 float slope = CALCSLOPE(next_a, xa);
2182 LOOP1(inNumSamples,
2183 ZXP(out) = sc_mod(xa, ZXP(b));
2184 xa += slope;
2186 unit->mPrevA = xa;
2191 void mod_ia(BinaryOpUGen *unit, int inNumSamples)
2193 float *out = ZOUT(0);
2194 float xa = ZIN0(0);
2195 float *b = ZIN(1);
2197 LOOP1(inNumSamples,
2198 ZXP(out) = sc_mod(xa, ZXP(b));
2200 unit->mPrevA = xa;
2204 void mod_ai(BinaryOpUGen *unit, int inNumSamples)
2206 float *out = ZOUT(0);
2207 float *a = ZIN(0);
2208 float xb = ZIN0(1);
2210 LOOP1(inNumSamples,
2211 ZXP(out) = sc_mod(ZXP(a), xb);
2213 unit->mPrevB = xb;
2218 void max_aa(BinaryOpUGen *unit, int inNumSamples)
2220 float *out = ZOUT(0);
2221 float *a = ZIN(0);
2222 float *b = ZIN(1);
2224 LOOP1(inNumSamples,
2225 float xa = ZXP(a);
2226 float xb = ZXP(b);
2227 ZXP(out) = sc_max(xa, xb);
2231 void max_ak(BinaryOpUGen *unit, int inNumSamples)
2233 float *out = ZOUT(0);
2234 float *a = ZIN(0);
2235 float xb = unit->mPrevB;
2236 float next_b = ZIN0(1);
2238 if (xb == next_b) {
2239 LOOP1(inNumSamples,
2240 float xa = ZXP(a);
2241 ZXP(out) = sc_max(xa, xb);
2243 } else {
2244 float slope = CALCSLOPE(next_b, xb);
2245 LOOP1(inNumSamples,
2246 float xa = ZXP(a);
2247 ZXP(out) = sc_max(xa, xb);
2248 xb += slope;
2250 unit->mPrevB = xb;
2254 void max_ka(BinaryOpUGen *unit, int inNumSamples)
2256 float *out = ZOUT(0);
2257 float xa = unit->mPrevA;
2258 float *b = ZIN(1);
2259 float next_a = ZIN0(0);
2261 if (xa == next_a) {
2262 LOOP1(inNumSamples,
2263 float xb = ZXP(b);
2264 ZXP(out) = sc_max(xa, xb);
2266 } else {
2267 float slope = CALCSLOPE(next_a, xa);
2268 LOOP1(inNumSamples,
2269 float xb = ZXP(b);
2270 ZXP(out) = sc_max(xa, xb);
2271 xa += slope;
2273 unit->mPrevA = xa;
2277 void max_ia(BinaryOpUGen *unit, int inNumSamples)
2279 float *out = ZOUT(0);
2280 float xa = ZIN0(0);
2281 float *b = ZIN(1);
2283 LOOP1(inNumSamples,
2284 float xb = ZXP(b);
2285 ZXP(out) = sc_max(xa, xb);
2287 unit->mPrevA = xa;
2291 void max_ai(BinaryOpUGen *unit, int inNumSamples)
2293 float *out = ZOUT(0);
2294 float *a = ZIN(0);
2295 float xb = ZIN0(1);
2297 LOOP1(inNumSamples,
2298 float xa = ZXP(a);
2299 ZXP(out) = sc_max(xa, xb);
2301 unit->mPrevB = xb;
2304 #ifdef NOVA_SIMD
2305 NOVA_BINARY_WRAPPER_K(max, max)
2306 #endif
2311 void min_aa(BinaryOpUGen *unit, int inNumSamples)
2313 float *out = ZOUT(0);
2314 float *a = ZIN(0);
2315 float *b = ZIN(1);
2317 LOOP1(inNumSamples,
2318 float xa = ZXP(a);
2319 float xb = ZXP(b);
2320 ZXP(out) = sc_min(xa, xb);
2324 void min_ak(BinaryOpUGen *unit, int inNumSamples)
2326 float *out = ZOUT(0);
2327 float *a = ZIN(0);
2328 float xb = unit->mPrevB;
2329 float next_b = ZIN0(1);
2331 if (xb == next_b) {
2332 LOOP1(inNumSamples,
2333 float xa = ZXP(a);
2334 ZXP(out) = sc_min(xa, xb);
2336 } else {
2337 float slope = CALCSLOPE(next_b, xb);
2338 LOOP1(inNumSamples,
2339 float xa = ZXP(a);
2340 ZXP(out) = sc_min(xa, xb);
2341 xb += slope;
2343 unit->mPrevB = xb;
2347 void min_ka(BinaryOpUGen *unit, int inNumSamples)
2349 float *out = ZOUT(0);
2350 float xa = unit->mPrevA;
2351 float *b = ZIN(1);
2352 float next_a = ZIN0(0);
2354 if (xa == next_a) {
2355 LOOP1(inNumSamples,
2356 float xb = ZXP(b);
2357 ZXP(out) = sc_min(xa, xb);
2359 } else {
2360 float slope = CALCSLOPE(next_a, xa);
2361 LOOP1(inNumSamples,
2362 float xb = ZXP(b);
2363 ZXP(out) = sc_min(xa, xb);
2364 xa += slope;
2366 unit->mPrevA = xa;
2370 void min_ia(BinaryOpUGen *unit, int inNumSamples)
2372 float *out = ZOUT(0);
2373 float xa = ZIN0(0);
2374 float *b = ZIN(1);
2376 LOOP1(inNumSamples,
2377 float xb = ZXP(b);
2378 ZXP(out) = sc_min(xa, xb);
2380 unit->mPrevA = xa;
2384 void min_ai(BinaryOpUGen *unit, int inNumSamples)
2386 float *out = ZOUT(0);
2387 float *a = ZIN(0);
2388 float xb = ZIN0(1);
2390 LOOP1(inNumSamples,
2391 float xa = ZXP(a);
2392 ZXP(out) = sc_min(xa, xb);
2394 unit->mPrevB = xb;
2398 #ifdef NOVA_SIMD
2399 NOVA_BINARY_WRAPPER_K(min, min)
2400 #endif
2403 void and_aa(BinaryOpUGen *unit, int inNumSamples)
2405 float *out = ZOUT(0);
2406 float *a = ZIN(0);
2407 float *b = ZIN(1);
2409 LOOP1(inNumSamples,
2410 float xa = ZXP(a);
2411 float xb = ZXP(b);
2412 ZXP(out) = sc_andt(xa, xb) ;
2416 void and_ak(BinaryOpUGen *unit, int inNumSamples)
2418 float *out = ZOUT(0);
2419 float *a = ZIN(0);
2420 float xb = unit->mPrevB;
2421 float next_b = ZIN0(1);
2423 if (xb == next_b) {
2424 LOOP1(inNumSamples,
2425 float xa = ZXP(a);
2426 ZXP(out) = sc_andt(xa, xb);
2428 } else {
2429 float slope = CALCSLOPE(next_b, xb);
2430 LOOP1(inNumSamples,
2431 float xa = ZXP(a);
2432 ZXP(out) = sc_andt(xa, xb);
2433 xb += slope;
2435 unit->mPrevB = xb;
2439 void and_ka(BinaryOpUGen *unit, int inNumSamples)
2441 float *out = ZOUT(0);
2442 float xa = unit->mPrevA;
2443 float *b = ZIN(1);
2444 float next_a = ZIN0(0);
2446 if (xa == next_a) {
2447 LOOP1(inNumSamples,
2448 float xb = ZXP(b);
2449 ZXP(out) = sc_andt(xa, xb);
2451 } else {
2452 float slope = CALCSLOPE(next_a, xa);
2453 LOOP1(inNumSamples,
2454 float xb = ZXP(b);
2455 ZXP(out) = sc_andt(xa, xb);
2456 xa += slope;
2458 unit->mPrevA = xa;
2462 void and_ia(BinaryOpUGen *unit, int inNumSamples)
2464 float *out = ZOUT(0);
2465 float xa = ZIN0(0);
2466 float *b = ZIN(1);
2468 LOOP1(inNumSamples,
2469 float xb = ZXP(b);
2470 ZXP(out) = sc_andt(xa, xb);
2472 unit->mPrevA = xa;
2476 void and_ai(BinaryOpUGen *unit, int inNumSamples)
2478 float *out = ZOUT(0);
2479 float *a = ZIN(0);
2480 float xb = ZIN0(1);
2482 LOOP1(inNumSamples,
2483 float xa = ZXP(a);
2484 ZXP(out) = sc_andt(xa, xb);
2486 unit->mPrevB = xb;
2495 void or_aa(BinaryOpUGen *unit, int inNumSamples)
2497 float *out = ZOUT(0);
2498 float *a = ZIN(0);
2499 float *b = ZIN(1);
2501 LOOP1(inNumSamples,
2502 float xa = ZXP(a);
2503 float xb = ZXP(b);
2504 ZXP(out) = sc_ort(xa, xb) ;
2508 void or_ak(BinaryOpUGen *unit, int inNumSamples)
2510 float *out = ZOUT(0);
2511 float *a = ZIN(0);
2512 float xb = unit->mPrevB;
2513 float next_b = ZIN0(1);
2515 if (xb == next_b) {
2516 LOOP1(inNumSamples,
2517 float xa = ZXP(a);
2518 ZXP(out) = sc_ort(xa, xb);
2520 } else {
2521 float slope = CALCSLOPE(next_b, xb);
2522 LOOP1(inNumSamples,
2523 float xa = ZXP(a);
2524 ZXP(out) = sc_ort(xa, xb);
2525 xb += slope;
2527 unit->mPrevB = xb;
2531 void or_ka(BinaryOpUGen *unit, int inNumSamples)
2533 float *out = ZOUT(0);
2534 float xa = unit->mPrevA;
2535 float *b = ZIN(1);
2536 float next_a = ZIN0(0);
2538 if (xa == next_a) {
2539 LOOP1(inNumSamples,
2540 float xb = ZXP(b);
2541 ZXP(out) = sc_ort(xa, xb);
2543 } else {
2544 float slope = CALCSLOPE(next_a, xa);
2545 LOOP1(inNumSamples,
2546 float xb = ZXP(b);
2547 ZXP(out) = sc_ort(xa, xb);
2548 xa += slope;
2550 unit->mPrevA = xa;
2554 void or_ia(BinaryOpUGen *unit, int inNumSamples)
2556 float *out = ZOUT(0);
2557 float xa = ZIN0(0);
2558 float *b = ZIN(1);
2560 LOOP1(inNumSamples,
2561 float xb = ZXP(b);
2562 ZXP(out) = sc_ort(xa, xb);
2564 unit->mPrevA = xa;
2568 void or_ai(BinaryOpUGen *unit, int inNumSamples)
2570 float *out = ZOUT(0);
2571 float *a = ZIN(0);
2572 float xb = ZIN0(1);
2574 LOOP1(inNumSamples,
2575 float xa = ZXP(a);
2576 ZXP(out) = sc_ort(xa, xb);
2578 unit->mPrevB = xb;
2587 void xor_aa(BinaryOpUGen *unit, int inNumSamples)
2589 float *out = ZOUT(0);
2590 float *a = ZIN(0);
2591 float *b = ZIN(1);
2593 LOOP1(inNumSamples,
2594 float xa = ZXP(a);
2595 float xb = ZXP(b);
2596 ZXP(out) = sc_xort(xa, xb) ;
2600 void xor_ak(BinaryOpUGen *unit, int inNumSamples)
2602 float *out = ZOUT(0);
2603 float *a = ZIN(0);
2604 float xb = unit->mPrevB;
2605 float next_b = ZIN0(1);
2607 if (xb == next_b) {
2608 LOOP1(inNumSamples,
2609 float xa = ZXP(a);
2610 ZXP(out) = sc_xort(xa, xb);
2612 } else {
2613 float slope = CALCSLOPE(next_b, xb);
2614 LOOP1(inNumSamples,
2615 float xa = ZXP(a);
2616 ZXP(out) = sc_xort(xa, xb);
2617 xb += slope;
2619 unit->mPrevB = xb;
2623 void xor_ka(BinaryOpUGen *unit, int inNumSamples)
2625 float *out = ZOUT(0);
2626 float xa = unit->mPrevA;
2627 float *b = ZIN(1);
2628 float next_a = ZIN0(0);
2630 if (xa == next_a) {
2631 LOOP1(inNumSamples,
2632 float xb = ZXP(b);
2633 ZXP(out) = sc_xort(xa, xb);
2635 } else {
2636 float slope = CALCSLOPE(next_a, xa);
2637 LOOP1(inNumSamples,
2638 float xb = ZXP(b);
2639 ZXP(out) = sc_xort(xa, xb);
2640 xa += slope;
2642 unit->mPrevA = xa;
2646 void xor_ia(BinaryOpUGen *unit, int inNumSamples)
2648 float *out = ZOUT(0);
2649 float xa = ZIN0(0);
2650 float *b = ZIN(1);
2652 LOOP1(inNumSamples,
2653 float xb = ZXP(b);
2654 ZXP(out) = sc_xort(xa, xb);
2656 unit->mPrevA = xa;
2660 void xor_ai(BinaryOpUGen *unit, int inNumSamples)
2662 float *out = ZOUT(0);
2663 float *a = ZIN(0);
2664 float xb = ZIN0(1);
2666 LOOP1(inNumSamples,
2667 float xa = ZXP(a);
2668 ZXP(out) = sc_xort(xa, xb);
2670 unit->mPrevB = xb;
2676 void rightShift_aa(BinaryOpUGen *unit, int inNumSamples)
2678 float *out = ZOUT(0);
2679 float *a = ZIN(0);
2680 float *b = ZIN(1);
2682 LOOP1(inNumSamples,
2683 float xa = ZXP(a);
2684 float xb = ZXP(b);
2685 ZXP(out) = sc_rst(xa, xb) ;
2689 void rightShift_ak(BinaryOpUGen *unit, int inNumSamples)
2691 float *out = ZOUT(0);
2692 float *a = ZIN(0);
2693 float xb = unit->mPrevB;
2694 float next_b = ZIN0(1);
2696 if (xb == next_b) {
2697 LOOP1(inNumSamples,
2698 float xa = ZXP(a);
2699 ZXP(out) = sc_rst(xa, xb);
2701 } else {
2702 float slope = CALCSLOPE(next_b, xb);
2703 LOOP1(inNumSamples,
2704 float xa = ZXP(a);
2705 ZXP(out) = sc_rst(xa, xb);
2706 xb += slope;
2708 unit->mPrevB = xb;
2712 void rightShift_ka(BinaryOpUGen *unit, int inNumSamples)
2714 float *out = ZOUT(0);
2715 float xa = unit->mPrevA;
2716 float *b = ZIN(1);
2717 float next_a = ZIN0(0);
2719 if (xa == next_a) {
2720 LOOP1(inNumSamples,
2721 float xb = ZXP(b);
2722 ZXP(out) = sc_rst(xa, xb);
2724 } else {
2725 float slope = CALCSLOPE(next_a, xa);
2726 LOOP1(inNumSamples,
2727 float xb = ZXP(b);
2728 ZXP(out) = sc_rst(xa, xb);
2729 xa += slope;
2731 unit->mPrevA = xa;
2735 void rightShift_ia(BinaryOpUGen *unit, int inNumSamples)
2737 float *out = ZOUT(0);
2738 float xa = ZIN0(0);
2739 float *b = ZIN(1);
2741 LOOP1(inNumSamples,
2742 float xb = ZXP(b);
2743 ZXP(out) = sc_rst(xa, xb);
2745 unit->mPrevA = xa;
2749 void rightShift_ai(BinaryOpUGen *unit, int inNumSamples)
2751 float *out = ZOUT(0);
2752 float *a = ZIN(0);
2753 float xb = ZIN0(1);
2755 LOOP1(inNumSamples,
2756 float xa = ZXP(a);
2757 ZXP(out) = sc_rst(xa, xb);
2759 unit->mPrevB = xb;
2764 void leftShift_aa(BinaryOpUGen *unit, int inNumSamples)
2766 float *out = ZOUT(0);
2767 float *a = ZIN(0);
2768 float *b = ZIN(1);
2770 LOOP1(inNumSamples,
2771 float xa = ZXP(a);
2772 float xb = ZXP(b);
2773 ZXP(out) = sc_lst(xa, xb) ;
2777 void leftShift_ak(BinaryOpUGen *unit, int inNumSamples)
2779 float *out = ZOUT(0);
2780 float *a = ZIN(0);
2781 float xb = unit->mPrevB;
2782 float next_b = ZIN0(1);
2784 if (xb == next_b) {
2785 LOOP1(inNumSamples,
2786 float xa = ZXP(a);
2787 ZXP(out) = sc_lst(xa, xb);
2789 } else {
2790 float slope = CALCSLOPE(next_b, xb);
2791 LOOP1(inNumSamples,
2792 float xa = ZXP(a);
2793 ZXP(out) = sc_lst(xa, xb);
2794 xb += slope;
2796 unit->mPrevB = xb;
2800 void leftShift_ka(BinaryOpUGen *unit, int inNumSamples)
2802 float *out = ZOUT(0);
2803 float xa = unit->mPrevA;
2804 float *b = ZIN(1);
2805 float next_a = ZIN0(0);
2807 if (xa == next_a) {
2808 LOOP1(inNumSamples,
2809 float xb = ZXP(b);
2810 ZXP(out) = sc_lst(xa, xb);
2812 } else {
2813 float slope = CALCSLOPE(next_a, xa);
2814 LOOP1(inNumSamples,
2815 float xb = ZXP(b);
2816 ZXP(out) = sc_lst(xa, xb);
2817 xa += slope;
2819 unit->mPrevA = xa;
2823 void leftShift_ia(BinaryOpUGen *unit, int inNumSamples)
2825 float *out = ZOUT(0);
2826 float xa = ZIN0(0);
2827 float *b = ZIN(1);
2829 LOOP1(inNumSamples,
2830 float xb = ZXP(b);
2831 ZXP(out) = sc_lst(xa, xb);
2833 unit->mPrevA = xa;
2837 void leftShift_ai(BinaryOpUGen *unit, int inNumSamples)
2839 float *out = ZOUT(0);
2840 float *a = ZIN(0);
2841 float xb = ZIN0(1);
2843 LOOP1(inNumSamples,
2844 float xa = ZXP(a);
2845 ZXP(out) = sc_lst(xa, xb);
2847 unit->mPrevB = xb;
2854 void amclip_aa(BinaryOpUGen *unit, int inNumSamples)
2856 float *out = ZOUT(0);
2857 float *a = ZIN(0);
2858 float *b = ZIN(1);
2860 LOOP1(inNumSamples,
2861 float xa = ZXP(a);
2862 float xb = ZXP(b);
2863 ZXP(out) = sc_amclip(xa, xb);
2867 void amclip_ak(BinaryOpUGen *unit, int inNumSamples)
2869 float *out = ZOUT(0);
2870 float *a = ZIN(0);
2871 float xb = unit->mPrevB;
2872 float next_b = ZIN0(1);
2874 if (xb == next_b) {
2875 if (xb > 0.f) {
2876 LOOP1(inNumSamples,
2877 ZXP(out) = ZXP(a) * xb;
2879 } else {
2880 ZClear(inNumSamples, out);
2882 } else {
2883 float slope = CALCSLOPE(next_b, xb);
2884 LOOP1(inNumSamples,
2885 float xa = ZXP(a);
2886 ZXP(out) = sc_amclip(xa, xb);
2887 xb += slope;
2889 unit->mPrevB = xb;
2893 void amclip_ka(BinaryOpUGen *unit, int inNumSamples)
2895 float *out = ZOUT(0);
2896 float xa = unit->mPrevA;
2897 float *b = ZIN(1);
2898 float next_a = ZIN0(0);
2900 if (xa == next_a) {
2901 LOOP1(inNumSamples,
2902 float xb = ZXP(b);
2903 ZXP(out) = sc_amclip(xa, xb);
2905 } else {
2906 float slope = CALCSLOPE(next_a, xa);
2907 LOOP1(inNumSamples,
2908 float xb = ZXP(b);
2909 ZXP(out) = sc_amclip(xa, xb);
2910 xa += slope;
2912 unit->mPrevA = xa;
2916 void amclip_ia(BinaryOpUGen *unit, int inNumSamples)
2918 float *out = ZOUT(0);
2919 float xa = ZIN0(0);
2920 float *b = ZIN(1);
2922 LOOP1(inNumSamples,
2923 float xb = ZXP(b);
2924 ZXP(out) = sc_amclip(xa, xb);
2926 unit->mPrevA = xa;
2930 void amclip_ai(BinaryOpUGen *unit, int inNumSamples)
2932 float *out = ZOUT(0);
2933 float *a = ZIN(0);
2934 float xb = ZIN0(1);
2936 LOOP1(inNumSamples,
2937 float xa = ZXP(a);
2938 ZXP(out) = sc_amclip(xa, xb);
2940 unit->mPrevB = xb;
2945 void scaleneg_aa(BinaryOpUGen *unit, int inNumSamples)
2947 float *out = ZOUT(0);
2948 float *a = ZIN(0);
2949 float *b = ZIN(1);
2951 LOOP1(inNumSamples,
2952 float xa = ZXP(a);
2953 float xb = ZXP(b);
2954 ZXP(out) = xa >= 0.f ? xa : xa * xb;
2958 void scaleneg_ak(BinaryOpUGen *unit, int inNumSamples)
2960 float *out = ZOUT(0);
2961 float *a = ZIN(0);
2962 float xb = unit->mPrevB;
2963 float next_b = ZIN0(1);
2965 if (xb == next_b) {
2966 LOOP1(inNumSamples,
2967 float xa = ZXP(a);
2968 ZXP(out) = xa >= 0.f ? xa : xa * xb;
2970 } else {
2971 float slope = CALCSLOPE(next_b, xb);
2972 LOOP1(inNumSamples,
2973 float xa = ZXP(a);
2974 ZXP(out) = xa >= 0.f ? xa : xa * xb;
2975 xb += slope;
2977 unit->mPrevB = xb;
2981 void scaleneg_ka(BinaryOpUGen *unit, int inNumSamples)
2983 float *out = ZOUT(0);
2984 float xa = unit->mPrevA;
2985 float *b = ZIN(1);
2986 float next_a = ZIN0(0);
2988 if (xa == next_a) {
2989 if (xa >= 0.f) {
2990 LOOP1(inNumSamples,
2991 ZXP(out) = xa;
2993 } else {
2994 LOOP1(inNumSamples,
2995 ZXP(out) = xa * ZXP(b);
2998 } else {
2999 float slope = CALCSLOPE(next_a, xa);
3000 LOOP1(inNumSamples,
3001 float xb = ZXP(b);
3002 ZXP(out) = xa >= 0.f ? xa : xa * xb;
3003 xa += slope;
3005 unit->mPrevA = xa;
3009 void scaleneg_ia(BinaryOpUGen *unit, int inNumSamples)
3011 float *out = ZOUT(0);
3012 float xa = ZIN0(0);
3013 float *b = ZIN(1);
3015 LOOP1(inNumSamples,
3016 float xb = ZXP(b);
3017 ZXP(out) = xa >= 0.f ? xa : xa * xb;
3019 unit->mPrevA = xa;
3023 void scaleneg_ai(BinaryOpUGen *unit, int inNumSamples)
3025 float *out = ZOUT(0);
3026 float *a = ZIN(0);
3027 float xb = ZIN0(1);
3029 LOOP1(inNumSamples,
3030 float xa = ZXP(a);
3031 ZXP(out) = xa >= 0.f ? xa : xa * xb;
3033 unit->mPrevB = xb;
3039 void pow_aa(BinaryOpUGen *unit, int inNumSamples)
3041 float *out = ZOUT(0);
3042 float *a = ZIN(0);
3043 float *b = ZIN(1);
3045 LOOP1(inNumSamples,
3046 float xa = ZXP(a);
3047 float xb = ZXP(b);
3048 ZXP(out) = xa >= 0.f ? pow(xa, xb) : -pow(-xa, xb);
3053 void pow_ak(BinaryOpUGen *unit, int inNumSamples)
3055 float *out = ZOUT(0);
3056 float *a = ZIN(0);
3057 float xb = unit->mPrevB;
3058 float next_b = ZIN0(1);
3060 if (xb == next_b) {
3061 LOOP1(inNumSamples,
3062 float xa = ZXP(a);
3063 ZXP(out) = xa >= 0.f ? pow(xa, xb) : -pow(-xa, xb);
3065 } else {
3066 float slope = CALCSLOPE(next_b, xb);
3067 LOOP1(inNumSamples,
3068 float xa = ZXP(a);
3069 ZXP(out) = xa >= 0.f ? pow(xa, xb) : -pow(-xa, xb);
3070 xb += slope;
3072 unit->mPrevB = xb;
3076 void pow_ka(BinaryOpUGen *unit, int inNumSamples)
3078 float *out = ZOUT(0);
3079 float xa = unit->mPrevA;
3080 float *b = ZIN(1);
3081 float next_a = ZIN0(0);
3083 if (xa == next_a) {
3084 if (xa >= 0.f) {
3085 LOOP1(inNumSamples,
3086 float xb = ZXP(b);
3087 ZXP(out) = pow(xa, xb);
3089 } else {
3090 LOOP1(inNumSamples,
3091 float xb = ZXP(b);
3092 ZXP(out) = -pow(-xa, xb);
3095 } else {
3096 float slope = CALCSLOPE(next_a, xa);
3097 LOOP1(inNumSamples,
3098 float xb = ZXP(b);
3099 ZXP(out) = xa >= 0.f ? pow(xa, xb) : -pow(-xa, xb);
3100 xa += slope;
3102 unit->mPrevA = xa;
3106 void pow_ia(BinaryOpUGen *unit, int inNumSamples)
3108 float *out = ZOUT(0);
3109 float xa = ZIN0(0);
3110 float *b = ZIN(1);
3112 LOOP1(inNumSamples,
3113 float xb = ZXP(b);
3114 ZXP(out) = xa >= 0.f ? pow(xa, xb) : -pow(-xa, xb);
3116 unit->mPrevA = xa;
3120 void pow_ai(BinaryOpUGen *unit, int inNumSamples)
3122 float *out = ZOUT(0);
3123 float *a = ZIN(0);
3124 float xb = ZIN0(1);
3126 LOOP1(inNumSamples,
3127 float xa = ZXP(a);
3128 ZXP(out) = xa >= 0.f ? pow(xa, xb) : -pow(-xa, xb);
3130 unit->mPrevB = xb;
3133 #ifdef NOVA_SIMD
3134 inline_functions void pow_aa_nova(BinaryOpUGen *unit, int inNumSamples)
3136 nova::spow_vec_simd(OUT(0), IN(0), IN(1), inNumSamples);
3139 inline_functions void pow_ak_nova(BinaryOpUGen *unit, int inNumSamples)
3141 float *out = ZOUT(0);
3142 float *a = ZIN(0);
3143 float xb = unit->mPrevB;
3144 float next_b = ZIN0(1);
3146 if (xb == next_b) {
3147 nova::spow_vec_simd(OUT(0), IN(0), xb, inNumSamples);
3148 } else {
3149 float slope = CALCSLOPE(next_b, xb);
3150 LOOP1(inNumSamples,
3151 float xa = ZXP(a);
3152 ZXP(out) = xa >= 0.f ? pow(xa, xb) : -pow(-xa, xb);
3153 xb += slope;
3155 unit->mPrevB = xb;
3159 inline_functions void pow_ka_nova(BinaryOpUGen *unit, int inNumSamples)
3161 float *out = ZOUT(0);
3162 float xa = unit->mPrevA;
3163 float *b = ZIN(1);
3164 float next_a = ZIN0(0);
3166 if (xa == next_a) {
3167 if (xa >= 0.f) {
3168 nova::pow_vec_simd(OUT(0), xa, IN(1), inNumSamples);
3169 } else {
3170 nova::spow_vec_simd(OUT(0), xa, IN(1), inNumSamples);
3172 } else {
3173 float slope = CALCSLOPE(next_a, xa);
3174 LOOP1(inNumSamples,
3175 float xb = ZXP(b);
3176 ZXP(out) = xa >= 0.f ? pow(xa, xb) : -pow(-xa, xb);
3177 xa += slope;
3179 unit->mPrevA = xa;
3184 inline_functions void pow_ia_nova(BinaryOpUGen *unit, int inNumSamples)
3186 float xa = ZIN0(0);
3187 if (xa > 0.f)
3188 nova::pow_vec_simd(OUT(0), xa, IN(1), inNumSamples);
3189 else
3190 nova::spow_vec_simd(OUT(0), xa, IN(1), inNumSamples);
3191 unit->mPrevA = xa;
3195 inline_functions void pow_ai_nova(BinaryOpUGen *unit, int inNumSamples)
3197 float xb = ZIN0(1);
3198 nova::spow_vec_simd(OUT(0), IN(0), xb, inNumSamples);
3199 unit->mPrevB = xb;
3201 #endif
3204 void ring1_aa(BinaryOpUGen *unit, int inNumSamples)
3206 float *out = ZOUT(0);
3207 float *a = ZIN(0);
3208 float *b = ZIN(1);
3210 LOOP1(inNumSamples,
3211 float xa = ZXP(a);
3212 float xb = ZXP(b);
3213 ZXP(out) = xa * xb + xa;
3217 void ring1_ak(BinaryOpUGen *unit, int inNumSamples)
3219 float *out = ZOUT(0);
3220 float *a = ZIN(0);
3221 float xb = unit->mPrevB;
3222 float next_b = ZIN0(1);
3224 if (xb == next_b) {
3225 if (xb == 0.f) {
3226 ZCopy(inNumSamples, out, a);
3227 } else if (xb == 1.f) {
3228 LOOP1(inNumSamples,
3229 float xa = ZXP(a);
3230 ZXP(out) = xa + xa;
3232 } else {
3233 LOOP1(inNumSamples,
3234 float xa = ZXP(a);
3235 ZXP(out) = xa * xb + xa;
3238 } else {
3239 float slope = CALCSLOPE(next_b, xb);
3240 LOOP1(inNumSamples,
3241 float xa = ZXP(a);
3242 ZXP(out) = xa * xb + xa;
3243 xb += slope;
3245 unit->mPrevB = xb;
3249 void ring1_ka(BinaryOpUGen *unit, int inNumSamples)
3251 float *out = ZOUT(0);
3252 float xa = unit->mPrevA;
3253 float *b = ZIN(1);
3254 float next_a = ZIN0(0);
3256 if (xa == next_a) {
3257 if (xa == 0.f) {
3258 LOOP1(inNumSamples,
3259 ZXP(out) = 0.f;
3261 } else {
3262 LOOP1(inNumSamples,
3263 float xb = ZXP(b);
3264 ZXP(out) = xa * xb + xa;
3267 } else {
3268 float slope = CALCSLOPE(next_a, xa);
3269 LOOP1(inNumSamples,
3270 float xb = ZXP(b);
3271 ZXP(out) = xa * xb + xa;
3272 xa += slope;
3274 unit->mPrevA = xa;
3278 void ring1_ia(BinaryOpUGen *unit, int inNumSamples)
3280 float *out = ZOUT(0);
3281 float xa = ZIN0(0);
3282 float *b = ZIN(1);
3284 LOOP1(inNumSamples,
3285 float xb = ZXP(b);
3286 ZXP(out) = xa * xb + xa;
3288 unit->mPrevA = xa;
3292 void ring1_ai(BinaryOpUGen *unit, int inNumSamples)
3294 float *out = ZOUT(0);
3295 float *a = ZIN(0);
3296 float xb = ZIN0(1);
3298 LOOP1(inNumSamples,
3299 float xa = ZXP(a);
3300 ZXP(out) = xa * xb + xa;
3302 unit->mPrevB = xb;
3308 void ring2_aa(BinaryOpUGen *unit, int inNumSamples)
3310 float *out = ZOUT(0);
3311 float *a = ZIN(0);
3312 float *b = ZIN(1);
3314 LOOP1(inNumSamples,
3315 float xa = ZXP(a);
3316 float xb = ZXP(b);
3317 ZXP(out) = xa * xb + xa + xb;
3321 void ring2_ak(BinaryOpUGen *unit, int inNumSamples)
3323 float *out = ZOUT(0);
3324 float *a = ZIN(0);
3325 float xb = unit->mPrevB;
3326 float next_b = ZIN0(1);
3328 if (xb == next_b) {
3329 if (xb == 0.f) {
3330 ZCopy(inNumSamples, out, a);
3331 } else {
3332 LOOP1(inNumSamples,
3333 float xa = ZXP(a);
3334 ZXP(out) = xa * xb + xa + xb;
3337 } else {
3338 float slope = CALCSLOPE(next_b, xb);
3339 LOOP1(inNumSamples,
3340 float xa = ZXP(a);
3341 ZXP(out) = xa * xb + xa + xb;
3342 xb += slope;
3344 unit->mPrevB = xb;
3348 void ring2_ka(BinaryOpUGen *unit, int inNumSamples)
3350 float *out = ZOUT(0);
3351 float xa = unit->mPrevA;
3352 float *b = ZIN(1);
3353 float next_a = ZIN0(0);
3355 if (xa == next_a) {
3356 if (xa == 0.f) {
3357 ZCopy(inNumSamples, out, b);
3358 } else {
3359 LOOP1(inNumSamples,
3360 float xb = ZXP(b);
3361 ZXP(out) = xa * xb + xa + xb;
3364 } else {
3365 float slope = CALCSLOPE(next_a, xa);
3366 LOOP1(inNumSamples,
3367 float xb = ZXP(b);
3368 ZXP(out) = xa * xb + xa + xb;
3369 xa += slope;
3371 unit->mPrevA = xa;
3375 void ring2_ia(BinaryOpUGen *unit, int inNumSamples)
3377 float *out = ZOUT(0);
3378 float xa = ZIN0(0);
3379 float *b = ZIN(1);
3381 LOOP1(inNumSamples,
3382 float xb = ZXP(b);
3383 ZXP(out) = xa * xb + xa + xb;
3385 unit->mPrevA = xa;
3389 void ring2_ai(BinaryOpUGen *unit, int inNumSamples)
3391 float *out = ZOUT(0);
3392 float *a = ZIN(0);
3393 float xb = ZIN0(1);
3395 LOOP1(inNumSamples,
3396 float xa = ZXP(a);
3397 ZXP(out) = xa * xb + xa + xb;
3399 unit->mPrevB = xb;
3405 void ring3_aa(BinaryOpUGen *unit, int inNumSamples)
3407 float *out = ZOUT(0);
3408 float *a = ZIN(0);
3409 float *b = ZIN(1);
3411 LOOP1(inNumSamples,
3412 float xa = ZXP(a);
3413 float xb = ZXP(b);
3414 ZXP(out) = xa * xa * xb;
3418 void ring3_ak(BinaryOpUGen *unit, int inNumSamples)
3420 float *out = ZOUT(0);
3421 float *a = ZIN(0);
3422 float xb = unit->mPrevB;
3423 float next_b = ZIN0(1);
3425 if (xb == next_b) {
3426 if (xb == 0.f) {
3427 ZClear(inNumSamples, out);
3428 } else if (xb == 1.f) {
3429 LOOP1(inNumSamples,
3430 float xa = ZXP(a);
3431 ZXP(out) = xa * xa;
3433 } else {
3434 LOOP1(inNumSamples,
3435 float xa = ZXP(a);
3436 ZXP(out) = xa * xa * xb;
3439 } else {
3440 float slope = CALCSLOPE(next_b, xb);
3441 LOOP1(inNumSamples,
3442 float xa = ZXP(a);
3443 ZXP(out) = xa * xa * xb;
3444 xb += slope;
3446 unit->mPrevB = xb;
3450 void ring3_ka(BinaryOpUGen *unit, int inNumSamples)
3452 float *out = ZOUT(0);
3453 float xa = unit->mPrevA;
3454 float *b = ZIN(1);
3455 float next_a = ZIN0(0);
3457 if (xa == next_a) {
3458 if (xa == 0.f) {
3459 ZClear(inNumSamples, out);
3460 } else if (xa == 1.f) {
3461 ZCopy(inNumSamples, out, b);
3462 } else {
3463 LOOP1(inNumSamples,
3464 float xb = ZXP(b);
3465 ZXP(out) = xa * xa * xb;
3468 } else {
3469 float slope = CALCSLOPE(next_a, xa);
3470 LOOP1(inNumSamples,
3471 float xb = ZXP(b);
3472 ZXP(out) = xa * xa * xb;
3473 xa += slope;
3475 unit->mPrevA = xa;
3479 void ring3_ia(BinaryOpUGen *unit, int inNumSamples)
3481 float *out = ZOUT(0);
3482 float xa = ZIN0(0);
3483 float *b = ZIN(1);
3485 LOOP1(inNumSamples,
3486 float xb = ZXP(b);
3487 ZXP(out) = xa * xa * xb;
3489 unit->mPrevA = xa;
3493 void ring3_ai(BinaryOpUGen *unit, int inNumSamples)
3495 float *out = ZOUT(0);
3496 float *a = ZIN(0);
3497 float xb = ZIN0(1);
3499 LOOP1(inNumSamples,
3500 float xa = ZXP(a);
3501 ZXP(out) = xa * xa * xb;
3503 unit->mPrevB = xb;
3508 void ring4_aa(BinaryOpUGen *unit, int inNumSamples)
3510 float *out = ZOUT(0);
3511 float *a = ZIN(0);
3512 float *b = ZIN(1);
3514 LOOP1(inNumSamples,
3515 float xa = ZXP(a);
3516 float xb = ZXP(b);
3517 ZXP(out) = xa * xa * xb - xa * xb * xb;
3521 void ring4_ak(BinaryOpUGen *unit, int inNumSamples)
3523 float *out = ZOUT(0);
3524 float *a = ZIN(0);
3525 float xb = unit->mPrevB;
3526 float next_b = ZIN0(1);
3528 if (xb == next_b) {
3529 if (xb == 0.f) {
3530 ZClear(inNumSamples, out);
3531 } else if (xb == 1.f) {
3532 LOOP1(inNumSamples,
3533 float xa = ZXP(a);
3534 ZXP(out) = xa * xa - xa;
3536 } else {
3537 LOOP1(inNumSamples,
3538 float xa = ZXP(a);
3539 ZXP(out) = xa * xa * xb - xa * xb * xb;
3542 } else {
3543 float slope = CALCSLOPE(next_b, xb);
3544 LOOP1(inNumSamples,
3545 float xa = ZXP(a);
3546 ZXP(out) = xa * xa * xb - xa * xb * xb;
3547 xb += slope;
3549 unit->mPrevB = xb;
3553 void ring4_ka(BinaryOpUGen *unit, int inNumSamples)
3555 float *out = ZOUT(0);
3556 float xa = unit->mPrevA;
3557 float *b = ZIN(1);
3558 float next_a = ZIN0(0);
3560 if (xa == next_a) {
3561 if (xa == 0.f) {
3562 ZClear(inNumSamples, out);
3563 } else if (xa == 1.f) {
3564 LOOP1(inNumSamples,
3565 float xb = ZXP(b);
3566 ZXP(out) = xb - xb * xb;
3568 } else {
3569 LOOP1(inNumSamples,
3570 float xb = ZXP(b);
3571 ZXP(out) = xa * xa * xb - xa * xb * xb;
3574 } else {
3575 float slope = CALCSLOPE(next_a, xa);
3576 LOOP1(inNumSamples,
3577 float xb = ZXP(b);
3578 ZXP(out) = xa * xa * xb - xa * xb * xb;
3579 xa += slope;
3581 unit->mPrevA = xa;
3585 void ring4_ia(BinaryOpUGen *unit, int inNumSamples)
3587 float *out = ZOUT(0);
3588 float xa = ZIN0(0);
3589 float *b = ZIN(1);
3591 LOOP1(inNumSamples,
3592 float xb = ZXP(b);
3593 ZXP(out) = xa * xa * xb - xa * xb * xb;
3595 unit->mPrevA = xa;
3599 void ring4_ai(BinaryOpUGen *unit, int inNumSamples)
3601 float *out = ZOUT(0);
3602 float *a = ZIN(0);
3603 float xb = ZIN0(1);
3605 LOOP1(inNumSamples,
3606 float xa = ZXP(a);
3607 ZXP(out) = xa * xa * xb - xa * xb * xb;
3609 unit->mPrevB = xb;
3614 void thresh_aa(BinaryOpUGen *unit, int inNumSamples)
3616 float *out = ZOUT(0);
3617 float *a = ZIN(0);
3618 float *b = ZIN(1);
3620 LOOP1(inNumSamples,
3621 float xa = ZXP(a);
3622 float xb = ZXP(b);
3623 ZXP(out) = xa < xb ? 0.f : xa;
3627 void thresh_ak(BinaryOpUGen *unit, int inNumSamples)
3629 float *out = ZOUT(0);
3630 float *a = ZIN(0);
3631 float xb = unit->mPrevB;
3632 float next_b = ZIN0(1);
3634 if (xb == next_b) {
3635 LOOP1(inNumSamples,
3636 float xa = ZXP(a);
3637 ZXP(out) = xa < xb ? 0.f : xa;
3639 } else {
3640 float slope = CALCSLOPE(next_b, xb);
3641 LOOP1(inNumSamples,
3642 float xa = ZXP(a);
3643 ZXP(out) = xa < xb ? 0.f : xa;
3644 xb += slope;
3646 unit->mPrevB = xb;
3650 void thresh_ka(BinaryOpUGen *unit, int inNumSamples)
3652 float *out = ZOUT(0);
3653 float xa = unit->mPrevA;
3654 float *b = ZIN(1);
3655 float next_a = ZIN0(0);
3657 if (xa == next_a) {
3658 LOOP1(inNumSamples,
3659 float xb = ZXP(b);
3660 ZXP(out) = xa < xb ? 0.f : xa;
3662 } else {
3663 float slope = CALCSLOPE(next_a, xa);
3664 LOOP1(inNumSamples,
3665 float xb = ZXP(b);
3666 ZXP(out) = xa < xb ? 0.f : xa;
3667 xa += slope;
3669 unit->mPrevA = xa;
3673 void thresh_ia(BinaryOpUGen *unit, int inNumSamples)
3675 float *out = ZOUT(0);
3676 float xa = ZIN0(0);
3677 float *b = ZIN(1);
3679 LOOP1(inNumSamples,
3680 float xb = ZXP(b);
3681 ZXP(out) = xa < xb ? 0.f : xa;
3683 unit->mPrevA = xa;
3687 void thresh_ai(BinaryOpUGen *unit, int inNumSamples)
3689 float *out = ZOUT(0);
3690 float *a = ZIN(0);
3691 float xb = ZIN0(1);
3693 LOOP1(inNumSamples,
3694 float xa = ZXP(a);
3695 ZXP(out) = xa < xb ? 0.f : xa;
3697 unit->mPrevB = xb;
3702 void clip2_aa(BinaryOpUGen *unit, int inNumSamples)
3704 float *out = ZOUT(0);
3705 float *a = ZIN(0);
3706 float *b = ZIN(1);
3708 LOOP1(inNumSamples,
3709 float xa = ZXP(a);
3710 float xb = ZXP(b);
3711 ZXP(out) = xa > xb ? xb : (xa < -xb ? -xb : xa);
3715 void clip2_ak(BinaryOpUGen *unit, int inNumSamples)
3717 float *out = ZOUT(0);
3718 float *a = ZIN(0);
3719 float xb = unit->mPrevB;
3720 float next_b = ZIN0(1);
3722 if (xb == next_b) {
3723 LOOP1(inNumSamples,
3724 float xa = ZXP(a);
3725 ZXP(out) = xa > xb ? xb : (xa < -xb ? -xb : xa);
3727 } else {
3728 float slope = CALCSLOPE(next_b, xb);
3729 LOOP1(inNumSamples,
3730 float xa = ZXP(a);
3731 ZXP(out) = xa > xb ? xb : (xa < -xb ? -xb : xa);
3732 xb += slope;
3734 unit->mPrevB = xb;
3738 void clip2_ka(BinaryOpUGen *unit, int inNumSamples)
3740 float *out = ZOUT(0);
3741 float xa = unit->mPrevA;
3742 float *b = ZIN(1);
3743 float next_a = ZIN0(0);
3745 if (xa == next_a) {
3746 LOOP1(inNumSamples,
3747 float xb = ZXP(b);
3748 ZXP(out) = xa > xb ? xb : (xa < -xb ? -xb : xa);
3750 } else {
3751 float slope = CALCSLOPE(next_a, xa);
3752 LOOP1(inNumSamples,
3753 float xb = ZXP(b);
3754 ZXP(out) = xa > xb ? xb : (xa < -xb ? -xb : xa);
3755 xa += slope;
3757 unit->mPrevA = xa;
3761 void clip2_ia(BinaryOpUGen *unit, int inNumSamples)
3763 float *out = ZOUT(0);
3764 float xa = ZIN0(0);
3765 float *b = ZIN(1);
3767 LOOP1(inNumSamples,
3768 float xb = ZXP(b);
3769 ZXP(out) = xa > xb ? xb : (xa < -xb ? -xb : xa);
3771 unit->mPrevA = xa;
3775 void clip2_ai(BinaryOpUGen *unit, int inNumSamples)
3777 float *out = ZOUT(0);
3778 float *a = ZIN(0);
3779 float xb = ZIN0(1);
3781 LOOP1(inNumSamples,
3782 float xa = ZXP(a);
3783 ZXP(out) = xa > xb ? xb : (xa < -xb ? -xb : xa);
3785 unit->mPrevB = xb;
3789 #ifdef NOVA_SIMD
3790 NOVA_BINARY_WRAPPER_K(clip2, clip2)
3791 #endif
3794 void excess_aa(BinaryOpUGen *unit, int inNumSamples)
3796 float *out = ZOUT(0);
3797 float *a = ZIN(0);
3798 float *b = ZIN(1);
3800 LOOP1(inNumSamples,
3801 float xa = ZXP(a);
3802 float xb = ZXP(b);
3803 ZXP(out) = xa > xb ? xa-xb : (xa < -xb ? xa+xb : 0.f);
3807 void excess_ak(BinaryOpUGen *unit, int inNumSamples)
3809 float *out = ZOUT(0);
3810 float *a = ZIN(0);
3811 float xb = unit->mPrevB;
3812 float next_b = ZIN0(1);
3814 if (xb == next_b) {
3815 LOOP1(inNumSamples,
3816 float xa = ZXP(a);
3817 ZXP(out) = xa > xb ? xa-xb : (xa < -xb ? xa+xb : 0.f);
3819 } else {
3820 float slope = CALCSLOPE(next_b, xb);
3821 LOOP1(inNumSamples,
3822 float xa = ZXP(a);
3823 ZXP(out) = xa > xb ? xa-xb : (xa < -xb ? xa+xb : 0.f);
3824 xb += slope;
3826 unit->mPrevB = xb;
3830 void excess_ka(BinaryOpUGen *unit, int inNumSamples)
3832 float *out = ZOUT(0);
3833 float xa = unit->mPrevA;
3834 float *b = ZIN(1);
3835 float next_a = ZIN0(0);
3837 if (xa == next_a) {
3838 LOOP1(inNumSamples,
3839 float xb = ZXP(b);
3840 ZXP(out) = xa > xb ? xa-xb : (xa < -xb ? xa+xb : 0.f);
3842 } else {
3843 float slope = CALCSLOPE(next_a, xa);
3844 LOOP1(inNumSamples,
3845 float xb = ZXP(b);
3846 ZXP(out) = xa > xb ? xa-xb : (xa < -xb ? xa+xb : 0.f);
3847 xa += slope;
3849 unit->mPrevA = xa;
3853 void excess_ia(BinaryOpUGen *unit, int inNumSamples)
3855 float *out = ZOUT(0);
3856 float xa = ZIN0(0);
3857 float *b = ZIN(1);
3859 LOOP1(inNumSamples,
3860 float xb = ZXP(b);
3861 ZXP(out) = xa > xb ? xa-xb : (xa < -xb ? xa+xb : 0.f);
3863 unit->mPrevA = xa;
3867 void excess_ai(BinaryOpUGen *unit, int inNumSamples)
3869 float *out = ZOUT(0);
3870 float *a = ZIN(0);
3871 float xb = ZIN0(1);
3873 LOOP1(inNumSamples,
3874 float xa = ZXP(a);
3875 ZXP(out) = xa > xb ? xa-xb : (xa < -xb ? xa+xb : 0.f);
3877 unit->mPrevB = xb;
3882 void lt_aa(BinaryOpUGen *unit, int inNumSamples)
3884 float *out = ZOUT(0);
3885 float *a = ZIN(0);
3886 float *b = ZIN(1);
3888 LOOP1(inNumSamples,
3889 float xa = ZXP(a);
3890 float xb = ZXP(b);
3891 ZXP(out) = xa < xb ? 1.f : 0.f;
3895 #ifdef NOVA_SIMD
3896 NOVA_BINARY_WRAPPER_K(lt, less)
3897 #endif
3900 void lt_ak(BinaryOpUGen *unit, int inNumSamples)
3902 float *out = ZOUT(0);
3903 float *a = ZIN(0);
3904 float xb = unit->mPrevB;
3905 float next_b = ZIN0(1);
3907 if (xb == next_b) {
3908 LOOP1(inNumSamples,
3909 float xa = ZXP(a);
3910 ZXP(out) = xa < xb ? 1.f : 0.f;
3912 } else {
3913 float slope = CALCSLOPE(next_b, xb);
3914 LOOP1(inNumSamples,
3915 float xa = ZXP(a);
3916 ZXP(out) = xa < xb ? 1.f : 0.f;
3917 xb += slope;
3919 unit->mPrevB = xb;
3923 void lt_ka(BinaryOpUGen *unit, int inNumSamples)
3925 float *out = ZOUT(0);
3926 float xa = unit->mPrevA;
3927 float *b = ZIN(1);
3928 float next_a = ZIN0(0);
3930 if (xa == next_a) {
3931 LOOP1(inNumSamples,
3932 float xb = ZXP(b);
3933 ZXP(out) = xa < xb ? 1.f : 0.f;
3935 } else {
3936 float slope = CALCSLOPE(next_a, xa);
3937 LOOP1(inNumSamples,
3938 float xb = ZXP(b);
3939 ZXP(out) = xa < xb ? 1.f : 0.f;
3940 xa += slope;
3942 unit->mPrevA = xa;
3946 void lt_ia(BinaryOpUGen *unit, int inNumSamples)
3948 float *out = ZOUT(0);
3949 float xa = ZIN0(0);
3950 float *b = ZIN(1);
3952 LOOP1(inNumSamples,
3953 float xb = ZXP(b);
3954 ZXP(out) = xa < xb ? 1.f : 0.f;
3956 unit->mPrevA = xa;
3960 void lt_ai(BinaryOpUGen *unit, int inNumSamples)
3962 float *out = ZOUT(0);
3963 float *a = ZIN(0);
3964 float xb = ZIN0(1);
3966 LOOP1(inNumSamples,
3967 float xa = ZXP(a);
3968 ZXP(out) = xa < xb ? 1.f : 0.f;
3970 unit->mPrevB = xb;
3975 void le_aa(BinaryOpUGen *unit, int inNumSamples)
3977 float *out = ZOUT(0);
3978 float *a = ZIN(0);
3979 float *b = ZIN(1);
3981 LOOP1(inNumSamples,
3982 float xa = ZXP(a);
3983 float xb = ZXP(b);
3984 ZXP(out) = xa <= xb ? 1.f : 0.f;
3988 #ifdef NOVA_SIMD
3989 NOVA_BINARY_WRAPPER_K(le, less_equal)
3990 #endif
3992 void le_ak(BinaryOpUGen *unit, int inNumSamples)
3994 float *out = ZOUT(0);
3995 float *a = ZIN(0);
3996 float xb = unit->mPrevB;
3997 float next_b = ZIN0(1);
3999 if (xb == next_b) {
4000 LOOP1(inNumSamples,
4001 float xa = ZXP(a);
4002 ZXP(out) = xa <= xb ? 1.f : 0.f;
4004 } else {
4005 float slope = CALCSLOPE(next_b, xb);
4006 LOOP1(inNumSamples,
4007 float xa = ZXP(a);
4008 ZXP(out) = xa <= xb ? 1.f : 0.f;
4009 xb += slope;
4011 unit->mPrevB = xb;
4015 void le_ka(BinaryOpUGen *unit, int inNumSamples)
4017 float *out = ZOUT(0);
4018 float xa = unit->mPrevA;
4019 float *b = ZIN(1);
4020 float next_a = ZIN0(0);
4022 if (xa == next_a) {
4023 LOOP1(inNumSamples,
4024 float xb = ZXP(b);
4025 ZXP(out) = xa <= xb ? 1.f : 0.f;
4027 } else {
4028 float slope = CALCSLOPE(next_a, xa);
4029 LOOP1(inNumSamples,
4030 float xb = ZXP(b);
4031 ZXP(out) = xa <= xb ? 1.f : 0.f;
4032 xa += slope;
4034 unit->mPrevA = xa;
4038 void le_ia(BinaryOpUGen *unit, int inNumSamples)
4040 float *out = ZOUT(0);
4041 float xa = ZIN0(0);
4042 float *b = ZIN(1);
4044 LOOP1(inNumSamples,
4045 float xb = ZXP(b);
4046 ZXP(out) = xa <= xb ? 1.f : 0.f;
4048 unit->mPrevA = xa;
4052 void le_ai(BinaryOpUGen *unit, int inNumSamples)
4054 float *out = ZOUT(0);
4055 float *a = ZIN(0);
4056 float xb = ZIN0(1);
4058 LOOP1(inNumSamples,
4059 float xa = ZXP(a);
4060 ZXP(out) = xa <= xb ? 1.f : 0.f;
4062 unit->mPrevB = xb;
4067 void gt_aa(BinaryOpUGen *unit, int inNumSamples)
4069 float *out = ZOUT(0);
4070 float *a = ZIN(0);
4071 float *b = ZIN(1);
4073 LOOP1(inNumSamples,
4074 float xa = ZXP(a);
4075 float xb = ZXP(b);
4076 ZXP(out) = xa > xb ? 1.f : 0.f;
4080 #ifdef NOVA_SIMD
4081 NOVA_BINARY_WRAPPER_K(gt, greater)
4082 #endif
4085 void gt_ak(BinaryOpUGen *unit, int inNumSamples)
4087 float *out = ZOUT(0);
4088 float *a = ZIN(0);
4089 float xb = unit->mPrevB;
4090 float next_b = ZIN0(1);
4092 if (xb == next_b) {
4093 LOOP1(inNumSamples,
4094 float xa = ZXP(a);
4095 ZXP(out) = xa > xb ? 1.f : 0.f;
4097 } else {
4098 float slope = CALCSLOPE(next_b, xb);
4099 LOOP1(inNumSamples,
4100 float xa = ZXP(a);
4101 ZXP(out) = xa > xb ? 1.f : 0.f;
4102 xb += slope;
4104 unit->mPrevB = xb;
4108 void gt_ka(BinaryOpUGen *unit, int inNumSamples)
4110 float *out = ZOUT(0);
4111 float xa = unit->mPrevA;
4112 float *b = ZIN(1);
4113 float next_a = ZIN0(0);
4115 if (xa == next_a) {
4116 LOOP1(inNumSamples,
4117 float xb = ZXP(b);
4118 ZXP(out) = xa > xb ? 1.f : 0.f;
4120 } else {
4121 float slope = CALCSLOPE(next_a, xa);
4122 LOOP1(inNumSamples,
4123 float xb = ZXP(b);
4124 ZXP(out) = xa > xb ? 1.f : 0.f;
4125 xa += slope;
4127 unit->mPrevA = xa;
4131 void gt_ia(BinaryOpUGen *unit, int inNumSamples)
4133 float *out = ZOUT(0);
4134 float xa = ZIN0(0);
4135 float *b = ZIN(1);
4137 LOOP1(inNumSamples,
4138 float xb = ZXP(b);
4139 ZXP(out) = xa > xb ? 1.f : 0.f;
4141 unit->mPrevA = xa;
4145 void gt_ai(BinaryOpUGen *unit, int inNumSamples)
4147 float *out = ZOUT(0);
4148 float *a = ZIN(0);
4149 float xb = ZIN0(1);
4151 LOOP1(inNumSamples,
4152 float xa = ZXP(a);
4153 ZXP(out) = xa > xb ? 1.f : 0.f;
4155 unit->mPrevB = xb;
4160 void ge_aa(BinaryOpUGen *unit, int inNumSamples)
4162 float *out = ZOUT(0);
4163 float *a = ZIN(0);
4164 float *b = ZIN(1);
4166 LOOP1(inNumSamples,
4167 float xa = ZXP(a);
4168 float xb = ZXP(b);
4169 ZXP(out) = xa >= xb ? 1.f : 0.f;
4173 #ifdef NOVA_SIMD
4174 NOVA_BINARY_WRAPPER_K(ge, greater_equal)
4175 #endif
4178 void ge_ak(BinaryOpUGen *unit, int inNumSamples)
4180 float *out = ZOUT(0);
4181 float *a = ZIN(0);
4182 float xb = unit->mPrevB;
4183 float next_b = ZIN0(1);
4185 if (xb == next_b) {
4186 LOOP1(inNumSamples,
4187 float xa = ZXP(a);
4188 ZXP(out) = xa >= xb ? 1.f : 0.f;
4190 } else {
4191 float slope = CALCSLOPE(next_b, xb);
4192 LOOP1(inNumSamples,
4193 float xa = ZXP(a);
4194 ZXP(out) = xa >= xb ? 1.f : 0.f;
4195 xb += slope;
4197 unit->mPrevB = xb;
4201 void ge_ka(BinaryOpUGen *unit, int inNumSamples)
4203 float *out = ZOUT(0);
4204 float xa = unit->mPrevA;
4205 float *b = ZIN(1);
4206 float next_a = ZIN0(0);
4208 if (xa == next_a) {
4209 LOOP1(inNumSamples,
4210 float xb = ZXP(b);
4211 ZXP(out) = xa >= xb ? 1.f : 0.f;
4213 } else {
4214 float slope = CALCSLOPE(next_a, xa);
4215 LOOP1(inNumSamples,
4216 float xb = ZXP(b);
4217 ZXP(out) = xa >= xb ? 1.f : 0.f;
4218 xa += slope;
4220 unit->mPrevA = xa;
4224 void ge_ia(BinaryOpUGen *unit, int inNumSamples)
4226 float *out = ZOUT(0);
4227 float xa = ZIN0(0);
4228 float *b = ZIN(1);
4230 LOOP1(inNumSamples,
4231 float xb = ZXP(b);
4232 ZXP(out) = xa >= xb ? 1.f : 0.f;
4234 unit->mPrevA = xa;
4238 void ge_ai(BinaryOpUGen *unit, int inNumSamples)
4240 float *out = ZOUT(0);
4241 float *a = ZIN(0);
4242 float xb = ZIN0(1);
4244 LOOP1(inNumSamples,
4245 float xa = ZXP(a);
4246 ZXP(out) = xa >= xb ? 1.f : 0.f;
4248 unit->mPrevB = xb;
4253 void eq_aa(BinaryOpUGen *unit, int inNumSamples)
4255 float *out = ZOUT(0);
4256 float *a = ZIN(0);
4257 float *b = ZIN(1);
4259 LOOP1(inNumSamples,
4260 float xa = ZXP(a);
4261 float xb = ZXP(b);
4262 ZXP(out) = xa == xb ? 1.f : 0.f;
4266 #ifdef NOVA_SIMD
4267 NOVA_BINARY_WRAPPER_K(eq, equal)
4268 #endif
4270 void eq_ak(BinaryOpUGen *unit, int inNumSamples)
4272 float *out = ZOUT(0);
4273 float *a = ZIN(0);
4274 float xb = unit->mPrevB;
4275 float next_b = ZIN0(1);
4277 if (xb == next_b) {
4278 LOOP1(inNumSamples,
4279 float xa = ZXP(a);
4280 ZXP(out) = xa == xb ? 1.f : 0.f;
4282 } else {
4283 float slope = CALCSLOPE(next_b, xb);
4284 LOOP1(inNumSamples,
4285 float xa = ZXP(a);
4286 ZXP(out) = xa == xb ? 1.f : 0.f;
4287 xb += slope;
4289 unit->mPrevB = xb;
4293 void eq_ka(BinaryOpUGen *unit, int inNumSamples)
4295 float *out = ZOUT(0);
4296 float xa = unit->mPrevA;
4297 float *b = ZIN(1);
4298 float next_a = ZIN0(0);
4300 if (xa == next_a) {
4301 LOOP1(inNumSamples,
4302 float xb = ZXP(b);
4303 ZXP(out) = xa == xb ? 1.f : 0.f;
4305 } else {
4306 float slope = CALCSLOPE(next_a, xa);
4307 LOOP1(inNumSamples,
4308 float xb = ZXP(b);
4309 ZXP(out) = xa == xb ? 1.f : 0.f;
4310 xa += slope;
4312 unit->mPrevA = xa;
4316 void eq_ia(BinaryOpUGen *unit, int inNumSamples)
4318 float *out = ZOUT(0);
4319 float xa = ZIN0(0);
4320 float *b = ZIN(1);
4322 LOOP1(inNumSamples,
4323 float xb = ZXP(b);
4324 ZXP(out) = xa == xb ? 1.f : 0.f;
4326 unit->mPrevA = xa;
4330 void eq_ai(BinaryOpUGen *unit, int inNumSamples)
4332 float *out = ZOUT(0);
4333 float *a = ZIN(0);
4334 float xb = ZIN0(1);
4336 LOOP1(inNumSamples,
4337 float xa = ZXP(a);
4338 ZXP(out) = xa == xb ? 1.f : 0.f;
4340 unit->mPrevB = xb;
4345 void neq_aa(BinaryOpUGen *unit, int inNumSamples)
4347 float *out = ZOUT(0);
4348 float *a = ZIN(0);
4349 float *b = ZIN(1);
4351 LOOP1(inNumSamples,
4352 float xa = ZXP(a);
4353 float xb = ZXP(b);
4354 ZXP(out) = xa != xb ? 1.f : 0.f;
4358 #ifdef NOVA_SIMD
4359 NOVA_BINARY_WRAPPER_K(neq, notequal)
4360 #endif
4363 void neq_ak(BinaryOpUGen *unit, int inNumSamples)
4365 float *out = ZOUT(0);
4366 float *a = ZIN(0);
4367 float xb = unit->mPrevB;
4368 float next_b = ZIN0(1);
4370 if (xb == next_b) {
4371 LOOP1(inNumSamples,
4372 float xa = ZXP(a);
4373 ZXP(out) = xa != xb ? 1.f : 0.f;
4375 } else {
4376 float slope = CALCSLOPE(next_b, xb);
4377 LOOP1(inNumSamples,
4378 float xa = ZXP(a);
4379 ZXP(out) = xa != xb ? 1.f : 0.f;
4380 xb += slope;
4382 unit->mPrevB = xb;
4386 void neq_ka(BinaryOpUGen *unit, int inNumSamples)
4388 float *out = ZOUT(0);
4389 float xa = unit->mPrevA;
4390 float *b = ZIN(1);
4391 float next_a = ZIN0(0);
4393 if (xa == next_a) {
4394 LOOP1(inNumSamples,
4395 float xb = ZXP(b);
4396 ZXP(out) = xa != xb ? 1.f : 0.f;
4398 } else {
4399 float slope = CALCSLOPE(next_a, xa);
4400 LOOP1(inNumSamples,
4401 float xb = ZXP(b);
4402 ZXP(out) = xa != xb ? 1.f : 0.f;
4403 xa += slope;
4405 unit->mPrevA = xa;
4409 void neq_ia(BinaryOpUGen *unit, int inNumSamples)
4411 float *out = ZOUT(0);
4412 float xa = ZIN0(0);
4413 float *b = ZIN(1);
4415 LOOP1(inNumSamples,
4416 float xb = ZXP(b);
4417 ZXP(out) = xa != xb ? 1.f : 0.f;
4419 unit->mPrevA = xa;
4423 void neq_ai(BinaryOpUGen *unit, int inNumSamples)
4425 float *out = ZOUT(0);
4426 float *a = ZIN(0);
4427 float xb = ZIN0(1);
4429 LOOP1(inNumSamples,
4430 float xa = ZXP(a);
4431 ZXP(out) = xa != xb ? 1.f : 0.f;
4433 unit->mPrevB = xb;
4437 void sumsqr_aa(BinaryOpUGen *unit, int inNumSamples)
4439 float *out = ZOUT(0);
4440 float *a = ZIN(0);
4441 float *b = ZIN(1);
4443 LOOP1(inNumSamples,
4444 float xa = ZXP(a);
4445 float xb = ZXP(b);
4446 ZXP(out) = xa * xa + xb * xb;
4450 void sumsqr_ak(BinaryOpUGen *unit, int inNumSamples)
4452 float *out = ZOUT(0);
4453 float *a = ZIN(0);
4454 float xb = unit->mPrevB;
4455 float next_b = ZIN0(1);
4457 if (xb == next_b) {
4458 LOOP1(inNumSamples,
4459 float xa = ZXP(a);
4460 ZXP(out) = xa * xa + xb * xb;
4462 } else {
4463 float slope = CALCSLOPE(next_b, xb);
4464 LOOP1(inNumSamples,
4465 float xa = ZXP(a);
4466 ZXP(out) = xa * xa + xb * xb;
4467 xb += slope;
4469 unit->mPrevB = xb;
4473 void sumsqr_ka(BinaryOpUGen *unit, int inNumSamples)
4475 float *out = ZOUT(0);
4476 float xa = unit->mPrevA;
4477 float *b = ZIN(1);
4478 float next_a = ZIN0(0);
4480 if (xa == next_a) {
4481 LOOP1(inNumSamples,
4482 float xb = ZXP(b);
4483 ZXP(out) = xa * xa + xb * xb;
4485 } else {
4486 float slope = CALCSLOPE(next_a, xa);
4487 LOOP1(inNumSamples,
4488 float xb = ZXP(b);
4489 ZXP(out) = xa * xa + xb * xb;
4490 xa += slope;
4492 unit->mPrevA = xa;
4497 void sumsqr_ia(BinaryOpUGen *unit, int inNumSamples)
4499 float *out = ZOUT(0);
4500 float xa = ZIN0(0);
4501 float *b = ZIN(1);
4503 LOOP1(inNumSamples,
4504 float xb = ZXP(b);
4505 ZXP(out) = xa * xa + xb * xb;
4507 unit->mPrevA = xa;
4511 void sumsqr_ai(BinaryOpUGen *unit, int inNumSamples)
4513 float *out = ZOUT(0);
4514 float *a = ZIN(0);
4515 float xb = ZIN0(1);
4517 LOOP1(inNumSamples,
4518 float xa = ZXP(a);
4519 ZXP(out) = xa * xa + xb * xb;
4521 unit->mPrevB = xb;
4526 void difsqr_aa(BinaryOpUGen *unit, int inNumSamples)
4528 float *out = ZOUT(0);
4529 float *a = ZIN(0);
4530 float *b = ZIN(1);
4532 LOOP1(inNumSamples,
4533 float xa = ZXP(a);
4534 float xb = ZXP(b);
4535 ZXP(out) = xa * xa - xb * xb;
4539 void difsqr_ak(BinaryOpUGen *unit, int inNumSamples)
4541 float *out = ZOUT(0);
4542 float *a = ZIN(0);
4543 float xb = unit->mPrevB;
4544 float next_b = ZIN0(1);
4546 if (xb == next_b) {
4547 LOOP1(inNumSamples,
4548 float xa = ZXP(a);
4549 ZXP(out) = xa * xa - xb * xb;
4551 } else {
4552 float slope = CALCSLOPE(next_b, xb);
4553 LOOP1(inNumSamples,
4554 float xa = ZXP(a);
4555 ZXP(out) = xa * xa - xb * xb;
4556 xb += slope;
4558 unit->mPrevB = xb;
4562 void difsqr_ka(BinaryOpUGen *unit, int inNumSamples)
4564 float *out = ZOUT(0);
4565 float xa = unit->mPrevA;
4566 float *b = ZIN(1);
4567 float next_a = ZIN0(0);
4569 if (xa == next_a) {
4570 LOOP1(inNumSamples,
4571 float xb = ZXP(b);
4572 ZXP(out) = xa * xa - xb * xb;
4574 } else {
4575 float slope = CALCSLOPE(next_a, xa);
4576 LOOP1(inNumSamples,
4577 float xb = ZXP(b);
4578 ZXP(out) = xa * xa - xb * xb;
4579 xa += slope;
4581 unit->mPrevA = xa;
4585 void difsqr_ia(BinaryOpUGen *unit, int inNumSamples)
4587 float *out = ZOUT(0);
4588 float xa = ZIN0(0);
4589 float *b = ZIN(1);
4591 LOOP1(inNumSamples,
4592 float xb = ZXP(b);
4593 ZXP(out) = xa * xa - xb * xb;
4595 unit->mPrevA = xa;
4599 void difsqr_ai(BinaryOpUGen *unit, int inNumSamples)
4601 float *out = ZOUT(0);
4602 float *a = ZIN(0);
4603 float xb = ZIN0(1);
4605 LOOP1(inNumSamples,
4606 float xa = ZXP(a);
4607 ZXP(out) = xa * xa - xb * xb;
4609 unit->mPrevB = xb;
4613 void sqrsum_aa(BinaryOpUGen *unit, int inNumSamples)
4615 float *out = ZOUT(0);
4616 float *a = ZIN(0);
4617 float *b = ZIN(1);
4619 LOOP1(inNumSamples,
4620 float sum = ZXP(a) + ZXP(b);
4621 ZXP(out) = sum * sum;
4625 void sqrsum_ak(BinaryOpUGen *unit, int inNumSamples)
4627 float *out = ZOUT(0);
4628 float *a = ZIN(0);
4629 float xb = unit->mPrevB;
4630 float next_b = ZIN0(1);
4632 if (xb == next_b) {
4633 LOOP1(inNumSamples,
4634 float xa = ZXP(a);
4635 float sum = xa + xb;
4636 ZXP(out) = sum * sum;
4638 } else {
4639 float slope = CALCSLOPE(next_b, xb);
4640 LOOP1(inNumSamples,
4641 float xa = ZXP(a);
4642 float sum = xa + xb;
4643 ZXP(out) = sum * sum;
4644 xb += slope;
4646 unit->mPrevB = xb;
4650 void sqrsum_ka(BinaryOpUGen *unit, int inNumSamples)
4652 float *out = ZOUT(0);
4653 float xa = unit->mPrevA;
4654 float *b = ZIN(1);
4655 float next_a = ZIN0(0);
4657 if (xa == next_a) {
4658 LOOP1(inNumSamples,
4659 float xb = ZXP(b);
4660 float sum = xa + xb;
4661 ZXP(out) = sum * sum;
4663 } else {
4664 float slope = CALCSLOPE(next_a, xa);
4665 LOOP1(inNumSamples,
4666 float xb = ZXP(b);
4667 float sum = xa + xb;
4668 ZXP(out) = sum * sum;
4669 xa += slope;
4671 unit->mPrevA = xa;
4675 void sqrsum_ia(BinaryOpUGen *unit, int inNumSamples)
4677 float *out = ZOUT(0);
4678 float xa = ZIN0(0);
4679 float *b = ZIN(1);
4681 LOOP1(inNumSamples,
4682 float xb = ZXP(b);
4683 float sum = xa + xb;
4684 ZXP(out) = sum * sum;
4686 unit->mPrevA = xa;
4690 void sqrsum_ai(BinaryOpUGen *unit, int inNumSamples)
4692 float *out = ZOUT(0);
4693 float *a = ZIN(0);
4694 float xb = ZIN0(1);
4696 LOOP1(inNumSamples,
4697 float xa = ZXP(a);
4698 float sum = xa + xb;
4699 ZXP(out) = sum * sum;
4701 unit->mPrevB = xb;
4705 void sqrdif_aa(BinaryOpUGen *unit, int inNumSamples)
4707 float *out = ZOUT(0);
4708 float *a = ZIN(0);
4709 float *b = ZIN(1);
4711 LOOP1(inNumSamples,
4712 float dif = ZXP(a) - ZXP(b);
4713 ZXP(out) = dif * dif;
4717 void sqrdif_ak(BinaryOpUGen *unit, int inNumSamples)
4719 float *out = ZOUT(0);
4720 float *a = ZIN(0);
4721 float xb = unit->mPrevB;
4722 float next_b = ZIN0(1);
4724 if (xb == next_b) {
4725 LOOP1(inNumSamples,
4726 float xa = ZXP(a);
4727 float dif = xa - xb;
4728 ZXP(out) = dif * dif;
4730 } else {
4731 float slope = CALCSLOPE(next_b, xb);
4732 LOOP1(inNumSamples,
4733 float xa = ZXP(a);
4734 float dif = xa - xb;
4735 ZXP(out) = dif * dif;
4736 xb += slope;
4738 unit->mPrevB = xb;
4742 void sqrdif_ka(BinaryOpUGen *unit, int inNumSamples)
4744 float *out = ZOUT(0);
4745 float xa = unit->mPrevA;
4746 float *b = ZIN(1);
4747 float next_a = ZIN0(0);
4749 if (xa == next_a) {
4750 LOOP1(inNumSamples,
4751 float xb = ZXP(b);
4752 float dif = xa - xb;
4753 ZXP(out) = dif * dif;
4755 } else {
4756 float slope = CALCSLOPE(next_a, xa);
4757 LOOP1(inNumSamples,
4758 float xb = ZXP(b);
4759 float dif = xa - xb;
4760 ZXP(out) = dif * dif;
4761 xa += slope;
4763 unit->mPrevA = xa;
4768 void sqrdif_ia(BinaryOpUGen *unit, int inNumSamples)
4770 float *out = ZOUT(0);
4771 float xa = ZIN0(0);
4772 float *b = ZIN(1);
4774 LOOP1(inNumSamples,
4775 float xb = ZXP(b);
4776 float dif = xa - xb;
4777 ZXP(out) = dif * dif;
4779 unit->mPrevA = xa;
4783 void sqrdif_ai(BinaryOpUGen *unit, int inNumSamples)
4785 float *out = ZOUT(0);
4786 float *a = ZIN(0);
4787 float xb = ZIN0(1);
4789 LOOP1(inNumSamples,
4790 float xa = ZXP(a);
4791 float dif = xa - xb;
4792 ZXP(out) = dif * dif;
4794 unit->mPrevB = xb;
4798 void absdif_aa(BinaryOpUGen *unit, int inNumSamples)
4800 float *out = ZOUT(0);
4801 float *a = ZIN(0);
4802 float *b = ZIN(1);
4804 LOOP1(inNumSamples,
4805 float dif = ZXP(a) - ZXP(b);
4806 ZXP(out) = fabs(dif);
4810 void absdif_ak(BinaryOpUGen *unit, int inNumSamples)
4812 float *out = ZOUT(0);
4813 float *a = ZIN(0);
4814 float xb = unit->mPrevB;
4815 float next_b = ZIN0(1);
4817 if (xb == next_b) {
4818 LOOP1(inNumSamples,
4819 float xa = ZXP(a);
4820 float dif = xa - xb;
4821 ZXP(out) = fabs(dif);
4823 } else {
4824 float slope = CALCSLOPE(next_b, xb);
4825 LOOP1(inNumSamples,
4826 float xa = ZXP(a);
4827 float dif = xa - xb;
4828 ZXP(out) = fabs(dif);
4829 xb += slope;
4831 unit->mPrevB = xb;
4835 void absdif_ka(BinaryOpUGen *unit, int inNumSamples)
4837 float *out = ZOUT(0);
4838 float xa = unit->mPrevA;
4839 float *b = ZIN(1);
4840 float next_a = ZIN0(0);
4842 if (xa == next_a) {
4843 LOOP1(inNumSamples,
4844 float xb = ZXP(b);
4845 float dif = xa - xb;
4846 ZXP(out) = fabs(dif);
4848 } else {
4849 float slope = CALCSLOPE(next_a, xa);
4850 LOOP1(inNumSamples,
4851 float xb = ZXP(b);
4852 float dif = xa - xb;
4853 ZXP(out) = fabs(dif);
4854 xa += slope;
4856 unit->mPrevA = xa;
4860 void absdif_ia(BinaryOpUGen *unit, int inNumSamples)
4862 float *out = ZOUT(0);
4863 float xa = ZIN0(0);
4864 float *b = ZIN(1);
4866 LOOP1(inNumSamples,
4867 float xb = ZXP(b);
4868 float dif = xa - xb;
4869 ZXP(out) = fabs(dif);
4871 unit->mPrevA = xa;
4875 void absdif_ai(BinaryOpUGen *unit, int inNumSamples)
4877 float *out = ZOUT(0);
4878 float *a = ZIN(0);
4879 float xb = ZIN0(1);
4881 LOOP1(inNumSamples,
4882 float xa = ZXP(a);
4883 float dif = xa - xb;
4884 ZXP(out) = fabs(dif);
4886 unit->mPrevB = xb;
4890 void round_aa(BinaryOpUGen *unit, int inNumSamples)
4892 float *out = ZOUT(0);
4893 float *a = ZIN(0);
4894 float *b = ZIN(1);
4896 LOOP1(inNumSamples,
4897 float xa = ZXP(a);
4898 float xb = ZXP(b);
4899 ZXP(out) = sc_round(xa, xb);
4903 void round_ak(BinaryOpUGen *unit, int inNumSamples)
4905 float *out = ZOUT(0);
4906 float *a = ZIN(0);
4907 float xb = unit->mPrevB;
4908 float next_b = ZIN0(1);
4910 if (xb == next_b) {
4911 LOOP1(inNumSamples,
4912 float xa = ZXP(a);
4913 ZXP(out) = sc_round(xa, xb);
4915 } else {
4916 float slope = CALCSLOPE(next_b, xb);
4917 LOOP1(inNumSamples,
4918 float xa = ZXP(a);
4919 ZXP(out) = sc_round(xa, xb);
4920 xb += slope;
4922 unit->mPrevB = xb;
4926 void round_ka(BinaryOpUGen *unit, int inNumSamples)
4928 float *out = ZOUT(0);
4929 float xa = unit->mPrevA;
4930 float *b = ZIN(1);
4931 float next_a = ZIN0(0);
4933 if (xa == next_a) {
4934 LOOP1(inNumSamples,
4935 float xb = ZXP(b);
4936 ZXP(out) = sc_round(xa, xb);
4938 } else {
4939 float slope = CALCSLOPE(next_a, xa);
4940 LOOP1(inNumSamples,
4941 float xb = ZXP(b);
4942 ZXP(out) = sc_round(xa, xb);
4943 xa += slope;
4945 unit->mPrevA = xa;
4950 void round_ia(BinaryOpUGen *unit, int inNumSamples)
4952 float *out = ZOUT(0);
4953 float xa = ZIN0(0);
4954 float *b = ZIN(1);
4956 LOOP1(inNumSamples,
4957 float xb = ZXP(b);
4958 ZXP(out) = sc_round(xa, xb);
4960 unit->mPrevA = xa;
4964 void round_ai(BinaryOpUGen *unit, int inNumSamples)
4966 float *out = ZOUT(0);
4967 float *a = ZIN(0);
4968 float xb = ZIN0(1);
4970 LOOP1(inNumSamples,
4971 float xa = ZXP(a);
4972 ZXP(out) = sc_round(xa, xb);
4974 unit->mPrevB = xb;
4980 void roundUp_aa(BinaryOpUGen *unit, int inNumSamples)
4982 float *out = ZOUT(0);
4983 float *a = ZIN(0);
4984 float *b = ZIN(1);
4986 LOOP1(inNumSamples,
4987 float xa = ZXP(a);
4988 float xb = ZXP(b);
4989 ZXP(out) = sc_roundUp(xa, xb);
4993 void roundUp_ak(BinaryOpUGen *unit, int inNumSamples)
4995 float *out = ZOUT(0);
4996 float *a = ZIN(0);
4997 float xb = unit->mPrevB;
4998 float next_b = ZIN0(1);
5000 if (xb == next_b) {
5001 LOOP1(inNumSamples,
5002 float xa = ZXP(a);
5003 ZXP(out) = sc_roundUp(xa, xb);
5005 } else {
5006 float slope = CALCSLOPE(next_b, xb);
5007 LOOP1(inNumSamples,
5008 float xa = ZXP(a);
5009 ZXP(out) = sc_roundUp(xa, xb);
5010 xb += slope;
5012 unit->mPrevB = xb;
5016 void roundUp_ka(BinaryOpUGen *unit, int inNumSamples)
5018 float *out = ZOUT(0);
5019 float xa = unit->mPrevA;
5020 float *b = ZIN(1);
5021 float next_a = ZIN0(0);
5023 if (xa == next_a) {
5024 LOOP1(inNumSamples,
5025 float xb = ZXP(b);
5026 ZXP(out) = sc_roundUp(xa, xb);
5028 } else {
5029 float slope = CALCSLOPE(next_a, xa);
5030 LOOP1(inNumSamples,
5031 float xb = ZXP(b);
5032 ZXP(out) = sc_roundUp(xa, xb);
5033 xa += slope;
5035 unit->mPrevA = xa;
5040 void roundUp_ia(BinaryOpUGen *unit, int inNumSamples)
5042 float *out = ZOUT(0);
5043 float xa = ZIN0(0);
5044 float *b = ZIN(1);
5046 LOOP1(inNumSamples,
5047 float xb = ZXP(b);
5048 ZXP(out) = sc_roundUp(xa, xb);
5050 unit->mPrevA = xa;
5054 void roundUp_ai(BinaryOpUGen *unit, int inNumSamples)
5056 float *out = ZOUT(0);
5057 float *a = ZIN(0);
5058 float xb = ZIN0(1);
5060 LOOP1(inNumSamples,
5061 float xa = ZXP(a);
5062 ZXP(out) = sc_roundUp(xa, xb);
5064 unit->mPrevB = xb;
5069 void trunc_aa(BinaryOpUGen *unit, int inNumSamples)
5071 float *out = ZOUT(0);
5072 float *a = ZIN(0);
5073 float *b = ZIN(1);
5075 LOOP1(inNumSamples,
5076 float xa = ZXP(a);
5077 float xb = ZXP(b);
5078 ZXP(out) = sc_trunc(xa, xb);
5082 void trunc_ak(BinaryOpUGen *unit, int inNumSamples)
5084 float *out = ZOUT(0);
5085 float *a = ZIN(0);
5086 float xb = unit->mPrevB;
5087 float next_b = ZIN0(1);
5089 if (xb == next_b) {
5090 LOOP1(inNumSamples,
5091 float xa = ZXP(a);
5092 ZXP(out) = sc_trunc(xa, xb);
5094 } else {
5095 float slope = CALCSLOPE(next_b, xb);
5096 LOOP1(inNumSamples,
5097 float xa = ZXP(a);
5098 ZXP(out) = sc_trunc(xa, xb);
5099 xb += slope;
5101 unit->mPrevB = xb;
5105 void trunc_ka(BinaryOpUGen *unit, int inNumSamples)
5107 float *out = ZOUT(0);
5108 float xa = unit->mPrevA;
5109 float *b = ZIN(1);
5110 float next_a = ZIN0(0);
5112 if (xa == next_a) {
5113 LOOP1(inNumSamples,
5114 float xb = ZXP(b);
5115 ZXP(out) = sc_trunc(xa, xb);
5117 } else {
5118 float slope = CALCSLOPE(next_a, xa);
5119 LOOP1(inNumSamples,
5120 float xb = ZXP(b);
5121 ZXP(out) = sc_trunc(xa, xb);
5122 xa += slope;
5124 unit->mPrevA = xa;
5128 void trunc_ia(BinaryOpUGen *unit, int inNumSamples)
5130 float *out = ZOUT(0);
5131 float xa = ZIN0(0);
5132 float *b = ZIN(1);
5134 LOOP1(inNumSamples,
5135 float xb = ZXP(b);
5136 ZXP(out) = sc_trunc(xa, xb);
5138 unit->mPrevA = xa;
5142 void trunc_ai(BinaryOpUGen *unit, int inNumSamples)
5144 float *out = ZOUT(0);
5145 float *a = ZIN(0);
5146 float xb = ZIN0(1);
5148 LOOP1(inNumSamples,
5149 float xa = ZXP(a);
5150 ZXP(out) = sc_trunc(xa, xb);
5152 unit->mPrevB = xb;
5157 void fold2_aa(BinaryOpUGen *unit, int inNumSamples)
5159 float *out = ZOUT(0);
5160 float *a = ZIN(0);
5161 float *b = ZIN(1);
5163 LOOP1(inNumSamples,
5164 float xa = ZXP(a);
5165 float xb = ZXP(b);
5166 ZXP(out) = sc_fold(xa, -xb, xb);
5170 void fold2_ak(BinaryOpUGen *unit, int inNumSamples)
5172 float *out = ZOUT(0);
5173 float *a = ZIN(0);
5174 float xb = unit->mPrevB;
5175 float next_b = ZIN0(1);
5177 if (xb == next_b) {
5178 LOOP1(inNumSamples,
5179 float xa = ZXP(a);
5180 ZXP(out) = sc_fold(xa, -xb, xb);
5182 } else {
5183 float slope = CALCSLOPE(next_b, xb);
5184 LOOP1(inNumSamples,
5185 float xa = ZXP(a);
5186 ZXP(out) = sc_fold(xa, -xb, xb);
5187 xb += slope;
5189 unit->mPrevB = xb;
5193 void fold2_ka(BinaryOpUGen *unit, int inNumSamples)
5195 float *out = ZOUT(0);
5196 float xa = unit->mPrevA;
5197 float *b = ZIN(1);
5198 float next_a = ZIN0(0);
5200 if (xa == next_a) {
5201 LOOP1(inNumSamples,
5202 float xb = ZXP(b);
5203 ZXP(out) = sc_fold(xa, -xb, xb);
5205 } else {
5206 float slope = CALCSLOPE(next_a, xa);
5207 LOOP1(inNumSamples,
5208 float xb = ZXP(b);
5209 ZXP(out) = sc_fold(xa, -xb, xb);
5210 xa += slope;
5212 unit->mPrevA = xa;
5216 void fold2_ia(BinaryOpUGen *unit, int inNumSamples)
5218 float *out = ZOUT(0);
5219 float xa = ZIN0(0);
5220 float *b = ZIN(1);
5222 LOOP1(inNumSamples,
5223 float xb = ZXP(b);
5224 ZXP(out) = sc_fold(xa, -xb, xb);
5226 unit->mPrevA = xa;
5230 void fold2_ai(BinaryOpUGen *unit, int inNumSamples)
5232 float *out = ZOUT(0);
5233 float *a = ZIN(0);
5234 float xb = ZIN0(1);
5236 LOOP1(inNumSamples,
5237 float xa = ZXP(a);
5238 ZXP(out) = sc_fold(xa, -xb, xb);
5240 unit->mPrevB = xb;
5246 void wrap2_aa(BinaryOpUGen *unit, int inNumSamples)
5248 float *out = ZOUT(0);
5249 float *a = ZIN(0);
5250 float *b = ZIN(1);
5252 LOOP1(inNumSamples,
5253 float xa = ZXP(a);
5254 float xb = ZXP(b);
5255 ZXP(out) = sc_wrap(xa, -xb, xb);
5259 void wrap2_ak(BinaryOpUGen *unit, int inNumSamples)
5261 float *out = ZOUT(0);
5262 float *a = ZIN(0);
5263 float xb = unit->mPrevB;
5264 float next_b = ZIN0(1);
5266 if (xb == next_b) {
5267 LOOP1(inNumSamples,
5268 float xa = ZXP(a);
5269 ZXP(out) = sc_wrap(xa, -xb, xb);
5271 } else {
5272 float slope = CALCSLOPE(next_b, xb);
5273 LOOP1(inNumSamples,
5274 float xa = ZXP(a);
5275 ZXP(out) = sc_wrap(xa, -xb, xb);
5276 xb += slope;
5278 unit->mPrevB = xb;
5282 void wrap2_ka(BinaryOpUGen *unit, int inNumSamples)
5284 float *out = ZOUT(0);
5285 float xa = unit->mPrevA;
5286 float *b = ZIN(1);
5287 float next_a = ZIN0(0);
5289 if (xa == next_a) {
5290 LOOP1(inNumSamples,
5291 float xb = ZXP(b);
5292 ZXP(out) = sc_wrap(xa, -xb, xb);
5294 } else {
5295 float slope = CALCSLOPE(next_a, xa);
5296 LOOP1(inNumSamples,
5297 float xb = ZXP(b);
5298 ZXP(out) = sc_wrap(xa, -xb, xb);
5299 xa += slope;
5301 unit->mPrevA = xa;
5305 void wrap2_ia(BinaryOpUGen *unit, int inNumSamples)
5307 float *out = ZOUT(0);
5308 float xa = ZIN0(0);
5309 float *b = ZIN(1);
5311 LOOP1(inNumSamples,
5312 float xb = ZXP(b);
5313 ZXP(out) = sc_wrap(xa, -xb, xb);
5315 unit->mPrevA = xa;
5319 void wrap2_ai(BinaryOpUGen *unit, int inNumSamples)
5321 float *out = ZOUT(0);
5322 float *a = ZIN(0);
5323 float xb = ZIN0(1);
5325 LOOP1(inNumSamples,
5326 float xa = ZXP(a);
5327 ZXP(out) = sc_wrap(xa, -xb, xb);
5329 unit->mPrevB = xb;
5334 void atan2_aa(BinaryOpUGen *unit, int inNumSamples)
5336 float *out = ZOUT(0);
5337 float *a = ZIN(0);
5338 float *b = ZIN(1);
5340 LOOP1(inNumSamples,
5341 float xa = ZXP(a);
5342 float xb = ZXP(b);
5343 ZXP(out) = atan2(xa, xb);
5347 void atan2_ak(BinaryOpUGen *unit, int inNumSamples)
5349 float *out = ZOUT(0);
5350 float *a = ZIN(0);
5351 float xb = unit->mPrevB;
5352 float next_b = ZIN0(1);
5354 if (xb == next_b) {
5355 LOOP1(inNumSamples,
5356 float xa = ZXP(a);
5357 ZXP(out) = atan2(xa, xb);
5359 } else {
5360 float slope = CALCSLOPE(next_b, xb);
5361 LOOP1(inNumSamples,
5362 float xa = ZXP(a);
5363 ZXP(out) = atan2(xa, xb);
5364 xb += slope;
5366 unit->mPrevB = xb;
5370 void atan2_ka(BinaryOpUGen *unit, int inNumSamples)
5372 float *out = ZOUT(0);
5373 float xa = unit->mPrevA;
5374 float *b = ZIN(1);
5375 float next_a = ZIN0(0);
5377 if (xa == next_a) {
5378 LOOP1(inNumSamples,
5379 float xb = ZXP(b);
5380 ZXP(out) = atan2(xa, xb);
5382 } else {
5383 float slope = CALCSLOPE(next_a, xa);
5384 LOOP1(inNumSamples,
5385 float xb = ZXP(b);
5386 ZXP(out) = atan2(xa, xb);
5387 xa += slope;
5389 unit->mPrevA = xa;
5393 void atan2_ia(BinaryOpUGen *unit, int inNumSamples)
5395 float *out = ZOUT(0);
5396 float xa = ZIN0(0);
5397 float *b = ZIN(1);
5399 LOOP1(inNumSamples,
5400 float xb = ZXP(b);
5401 ZXP(out) = atan2(xa, xb);
5403 unit->mPrevA = xa;
5407 void atan2_ai(BinaryOpUGen *unit, int inNumSamples)
5409 float *out = ZOUT(0);
5410 float *a = ZIN(0);
5411 float xb = ZIN0(1);
5413 LOOP1(inNumSamples,
5414 float xa = ZXP(a);
5415 ZXP(out) = atan2(xa, xb);
5417 unit->mPrevB = xb;
5421 void hypot_aa(BinaryOpUGen *unit, int inNumSamples)
5423 float *out = ZOUT(0);
5424 float *a = ZIN(0);
5425 float *b = ZIN(1);
5427 LOOP1(inNumSamples,
5428 float xa = ZXP(a);
5429 float xb = ZXP(b);
5430 ZXP(out) = hypotf(xa, xb);
5434 void hypot_ak(BinaryOpUGen *unit, int inNumSamples)
5436 float *out = ZOUT(0);
5437 float *a = ZIN(0);
5438 float xb = unit->mPrevB;
5439 float next_b = ZIN0(1);
5441 if (xb == next_b) {
5442 LOOP1(inNumSamples,
5443 float xa = ZXP(a);
5444 ZXP(out) = hypotf(xa, xb);
5446 } else {
5447 float slope = CALCSLOPE(next_b, xb);
5448 LOOP1(inNumSamples,
5449 float xa = ZXP(a);
5450 ZXP(out) = hypotf(xa, xb);
5451 xb += slope;
5453 unit->mPrevB = xb;
5457 void hypot_ka(BinaryOpUGen *unit, int inNumSamples)
5459 float *out = ZOUT(0);
5460 float xa = unit->mPrevA;
5461 float *b = ZIN(1);
5462 float next_a = ZIN0(0);
5464 if (xa == next_a) {
5465 LOOP1(inNumSamples,
5466 float xb = ZXP(b);
5467 ZXP(out) = hypotf(xa, xb);
5469 } else {
5470 float slope = CALCSLOPE(next_a, xa);
5471 LOOP1(inNumSamples,
5472 float xb = ZXP(b);
5473 ZXP(out) = hypotf(xa, xb);
5474 xa += slope;
5476 unit->mPrevA = xa;
5480 void hypot_ia(BinaryOpUGen *unit, int inNumSamples)
5482 float *out = ZOUT(0);
5483 float xa = ZIN0(0);
5484 float *b = ZIN(1);
5486 LOOP1(inNumSamples,
5487 float xb = ZXP(b);
5488 ZXP(out) = hypotf(xa, xb);
5490 unit->mPrevA = xa;
5494 void hypot_ai(BinaryOpUGen *unit, int inNumSamples)
5496 float *out = ZOUT(0);
5497 float *a = ZIN(0);
5498 float xb = ZIN0(1);
5500 LOOP1(inNumSamples,
5501 float xa = ZXP(a);
5502 ZXP(out) = hypotf(xa, xb);
5504 unit->mPrevB = xb;
5509 void hypotx_aa(BinaryOpUGen *unit, int inNumSamples)
5511 float *out = ZOUT(0);
5512 float *a = ZIN(0);
5513 float *b = ZIN(1);
5515 LOOP1(inNumSamples,
5516 float xa = ZXP(a);
5517 float xb = ZXP(b);
5518 ZXP(out) = sc_hypotx(xa, xb);
5522 void hypotx_ak(BinaryOpUGen *unit, int inNumSamples)
5524 float *out = ZOUT(0);
5525 float *a = ZIN(0);
5526 float xb = unit->mPrevB;
5527 float next_b = ZIN0(1);
5529 if (xb == next_b) {
5530 LOOP1(inNumSamples,
5531 float xa = ZXP(a);
5532 ZXP(out) = sc_hypotx(xa, xb);
5534 } else {
5535 float slope = CALCSLOPE(next_b, xb);
5536 LOOP1(inNumSamples,
5537 float xa = ZXP(a);
5538 ZXP(out) = sc_hypotx(xa, xb);
5539 xb += slope;
5541 unit->mPrevB = xb;
5545 void hypotx_ka(BinaryOpUGen *unit, int inNumSamples)
5547 float *out = ZOUT(0);
5548 float xa = unit->mPrevA;
5549 float *b = ZIN(1);
5550 float next_a = ZIN0(0);
5552 if (xa == next_a) {
5553 LOOP1(inNumSamples,
5554 float xb = ZXP(b);
5555 ZXP(out) = sc_hypotx(xa, xb);
5557 } else {
5558 float slope = CALCSLOPE(next_a, xa);
5559 LOOP1(inNumSamples,
5560 float xb = ZXP(b);
5561 ZXP(out) = sc_hypotx(xa, xb);
5562 xa += slope;
5564 unit->mPrevA = xa;
5568 void hypotx_ia(BinaryOpUGen *unit, int inNumSamples)
5570 float *out = ZOUT(0);
5571 float xa = ZIN0(0);
5572 float *b = ZIN(1);
5574 LOOP1(inNumSamples,
5575 float xb = ZXP(b);
5576 ZXP(out) = sc_hypotx(xa, xb);
5578 unit->mPrevA = xa;
5582 void hypotx_ai(BinaryOpUGen *unit, int inNumSamples)
5584 float *out = ZOUT(0);
5585 float *a = ZIN(0);
5586 float xb = ZIN0(1);
5588 LOOP1(inNumSamples,
5589 float xa = ZXP(a);
5590 ZXP(out) = sc_hypotx(xa, xb);
5592 unit->mPrevB = xb;
5595 static BinaryOpFunc ChooseOneSampleFunc(BinaryOpUGen *unit)
5597 BinaryOpFunc func = &zero_1;
5599 switch (unit->mSpecialIndex) {
5600 //case opSilence2 : func = &zero_1; break;
5601 case opAdd : func = &add_1; break;
5602 case opSub : func = &sub_1; break;
5603 case opMul : func = &mul_1; break;
5604 case opFDiv : func = &div_1; break;
5605 case opMod : func = &mod_1; break;
5606 case opEQ : func = &eq_1; break;
5607 case opNE : func = &neq_1; break;
5608 case opLT : func = &lt_1; break;
5609 case opGT : func = &gt_1; break;
5610 case opLE : func = &le_1; break;
5611 case opGE : func = &ge_1; break;
5612 case opMin : func = &min_1; break;
5613 case opMax : func = &max_1; break;
5614 case opBitAnd : func = &and_1; break;
5615 case opBitOr : func = &or_1; break;
5616 case opBitXor : func = &xor_1; break;
5617 case opShiftRight : func = &rightShift_1; break;
5618 case opShiftLeft : func = &leftShift_1; break;
5619 case opRound : func = &round_1; break;
5620 case opRoundUp : func = &roundUp_1; break;
5621 case opTrunc : func = &trunc_1; break;
5622 case opAtan2 : func = &atan2_1; break;
5623 case opHypot : func = &hypot_1; break;
5624 case opHypotx : func = &hypotx_1; break;
5625 case opPow : func = &pow_1; break;
5626 case opRing1 : func = &ring1_1; break;
5627 case opRing2 : func = &ring2_1; break;
5628 case opRing3 : func = &ring3_1; break;
5629 case opRing4 : func = &ring4_1; break;
5630 case opDifSqr : func = &difsqr_1; break;
5631 case opSumSqr : func = &sumsqr_1; break;
5632 case opSqrSum : func = &sqrsum_1; break;
5633 case opSqrDif : func = &sqrdif_1; break;
5634 case opAbsDif : func = &absdif_1; break;
5635 case opThresh : func = &thresh_1; break;
5636 case opAMClip : func = &amclip_1; break;
5637 case opScaleNeg : func = &scaleneg_1; break;
5638 case opClip2 : func = &clip2_1; break;
5639 case opFold2 : func = &fold2_1; break;
5640 case opWrap2 : func = &wrap2_1; break;
5641 case opExcess : func = &excess_1; break;
5642 case opFirstArg : func = &firstarg_1; break;
5643 //case opSecondArg : func = &secondarg_1; break;
5644 default : func = &add_1; break;
5646 return func;
5650 static BinaryOpFunc ChooseDemandFunc(BinaryOpUGen *unit)
5652 BinaryOpFunc func = &zero_1;
5654 switch (unit->mSpecialIndex) {
5655 //case opSilence2 : func = &zero_d; break;
5656 case opAdd : func = &add_d; break;
5657 case opSub : func = &sub_d; break;
5658 case opMul : func = &mul_d; break;
5659 case opFDiv : func = &div_d; break;
5660 case opMod : func = &mod_d; break;
5661 case opEQ : func = &eq_d; break;
5662 case opNE : func = &neq_d; break;
5663 case opLT : func = &lt_d; break;
5664 case opGT : func = &gt_d; break;
5665 case opLE : func = &le_d; break;
5666 case opGE : func = &ge_d; break;
5667 case opMin : func = &min_d; break;
5668 case opMax : func = &max_d; break;
5669 case opBitAnd : func = &and_d; break;
5670 case opBitOr : func = &or_d; break;
5671 case opBitXor : func = &xor_d; break;
5672 case opShiftRight : func = &rightShift_d; break;
5673 case opShiftLeft : func = &leftShift_d; break;
5674 case opRound : func = &round_d; break;
5675 case opRoundUp : func = &roundUp_d; break;
5676 case opTrunc : func = &trunc_d; break;
5677 case opAtan2 : func = &atan2_d; break;
5678 case opHypot : func = &hypot_d; break;
5679 case opHypotx : func = &hypotx_d; break;
5680 case opPow : func = &pow_d; break;
5681 case opRing1 : func = &ring1_d; break;
5682 case opRing2 : func = &ring2_d; break;
5683 case opRing3 : func = &ring3_d; break;
5684 case opRing4 : func = &ring4_d; break;
5685 case opDifSqr : func = &difsqr_d; break;
5686 case opSumSqr : func = &sumsqr_d; break;
5687 case opSqrSum : func = &sqrsum_d; break;
5688 case opSqrDif : func = &sqrdif_d; break;
5689 case opAbsDif : func = &absdif_d; break;
5690 case opThresh : func = &thresh_d; break;
5691 case opAMClip : func = &amclip_d; break;
5692 case opScaleNeg : func = &scaleneg_d; break;
5693 case opClip2 : func = &clip2_d; break;
5694 case opFold2 : func = &fold2_d; break;
5695 case opWrap2 : func = &wrap2_d; break;
5696 case opExcess : func = &excess_d; break;
5697 case opFirstArg : func = &firstarg_d; break;
5698 //case opSecondArg : func = &secondarg_d; break;
5699 default : func = &add_d; break;
5701 return func;
5705 static BinaryOpFunc ChooseNormalFunc(BinaryOpUGen *unit)
5707 BinaryOpFunc func = &zero_1;
5709 int rateA = INRATE(0);
5710 int rateB = INRATE(1);
5712 switch (rateA) {
5713 case calc_FullRate:
5714 switch (rateB) {
5715 case calc_FullRate:
5716 switch (unit->mSpecialIndex) {
5717 //case opSilence2 : func = &zero_aa; break;
5718 case opAdd : func = &add_aa; break;
5719 case opSub : func = &sub_aa; break;
5720 case opMul : func = &mul_aa; break;
5721 case opFDiv : func = &div_aa; break;
5722 case opMod : func = &mod_aa; break;
5723 case opEQ : func = &eq_aa; break;
5724 case opNE : func = &neq_aa; break;
5725 case opLT : func = &lt_aa; break;
5726 case opGT : func = &gt_aa; break;
5727 case opLE : func = &le_aa; break;
5728 case opGE : func = &ge_aa; break;
5729 case opMin : func = &min_aa; break;
5730 case opMax : func = &max_aa; break;
5731 case opBitAnd : func = &and_aa; break;
5732 case opBitOr : func = &or_aa; break;
5733 case opBitXor : func = &xor_aa; break;
5734 case opShiftRight : func = &rightShift_aa; break;
5735 case opShiftLeft : func = &leftShift_aa; break;
5736 case opRound : func = &round_aa; break;
5737 case opRoundUp : func = &roundUp_aa; break;
5738 case opTrunc : func = &trunc_aa; break;
5739 case opAtan2 : func = &atan2_aa; break;
5740 case opHypot : func = &hypot_aa; break;
5741 case opHypotx : func = &hypotx_aa; break;
5742 case opPow : func = &pow_aa; break;
5743 case opRing1 : func = &ring1_aa; break;
5744 case opRing2 : func = &ring2_aa; break;
5745 case opRing3 : func = &ring3_aa; break;
5746 case opRing4 : func = &ring4_aa; break;
5747 case opDifSqr : func = &difsqr_aa; break;
5748 case opSumSqr : func = &sumsqr_aa; break;
5749 case opSqrSum : func = &sqrsum_aa; break;
5750 case opSqrDif : func = &sqrdif_aa; break;
5751 case opAbsDif : func = &absdif_aa; break;
5752 case opThresh : func = &thresh_aa; break;
5753 case opAMClip : func = &amclip_aa; break;
5754 case opScaleNeg : func = &scaleneg_aa; break;
5755 case opClip2 : func = &clip2_aa; break;
5756 case opFold2 : func = &fold2_aa; break;
5757 case opWrap2 : func = &wrap2_aa; break;
5758 case opExcess : func = &excess_aa; break;
5759 case opFirstArg : func = &firstarg_aa; break;
5760 //case opSecondArg : func = &secondarg_aa; break;
5761 default : func = &add_aa; break;
5763 break;
5764 case calc_BufRate :
5765 switch (unit->mSpecialIndex) {
5766 //case opSilence2 : func = &zero_aa; break;
5767 case opAdd : func = &add_ak; break;
5768 case opSub : func = &sub_ak; break;
5769 case opMul : func = &mul_ak; break;
5770 case opFDiv : func = &div_ak; break;
5771 case opMod : func = &mod_ak; break;
5772 case opEQ : func = &eq_ak; break;
5773 case opNE : func = &neq_ak; break;
5774 case opLT : func = &lt_ak; break;
5775 case opGT : func = &gt_ak; break;
5776 case opLE : func = &le_ak; break;
5777 case opGE : func = &ge_ak; break;
5778 case opMin : func = &min_ak; break;
5779 case opMax : func = &max_ak; break;
5780 case opBitAnd : func = &and_ak; break;
5781 case opBitOr : func = &or_ak; break;
5782 case opBitXor : func = &xor_ak; break;
5783 case opShiftRight : func = &rightShift_ak; break;
5784 case opShiftLeft : func = &leftShift_ak; break;
5785 case opRound : func = &round_ak; break;
5786 case opRoundUp : func = &roundUp_ak; break;
5787 case opTrunc : func = &trunc_ak; break;
5788 case opAtan2 : func = &atan2_ak; break;
5789 case opHypot : func = &hypot_ak; break;
5790 case opHypotx : func = &hypotx_ak; break;
5791 case opPow : func = &pow_ak; break;
5792 case opRing1 : func = &ring1_ak; break;
5793 case opRing2 : func = &ring2_ak; break;
5794 case opRing3 : func = &ring3_ak; break;
5795 case opRing4 : func = &ring4_ak; break;
5796 case opDifSqr : func = &difsqr_ak; break;
5797 case opSumSqr : func = &sumsqr_ak; break;
5798 case opSqrSum : func = &sqrsum_ak; break;
5799 case opSqrDif : func = &sqrdif_ak; break;
5800 case opAbsDif : func = &absdif_ak; break;
5801 case opThresh : func = &thresh_ak; break;
5802 case opAMClip : func = &amclip_ak; break;
5803 case opScaleNeg : func = &scaleneg_ak; break;
5804 case opClip2 : func = &clip2_ak; break;
5805 case opFold2 : func = &fold2_ak; break;
5806 case opWrap2 : func = &wrap2_ak; break;
5807 case opExcess : func = &excess_ak; break;
5808 case opFirstArg : func = &firstarg_aa; break;
5809 //case opSecondArg : func = &secondarg_aa; break;
5810 default : func = &add_ak; break;
5812 break;
5813 case calc_ScalarRate :
5814 switch (unit->mSpecialIndex) {
5815 //case opSilence2 : func = &zero_aa; break;
5816 case opAdd : func = &add_ai; break;
5817 case opSub : func = &sub_ai; break;
5818 case opMul : func = &mul_ai; break;
5819 case opFDiv : func = &div_ai; break;
5820 case opMod : func = &mod_ai; break;
5821 case opEQ : func = &eq_ai; break;
5822 case opNE : func = &neq_ai; break;
5823 case opLT : func = &lt_ai; break;
5824 case opGT : func = &gt_ai; break;
5825 case opLE : func = &le_ai; break;
5826 case opGE : func = &ge_ai; break;
5827 case opMin : func = &min_ai; break;
5828 case opMax : func = &max_ai; break;
5829 case opBitAnd : func = &and_ai; break;
5830 case opBitOr : func = &or_ai; break;
5831 case opBitXor : func = &xor_ai; break;
5832 case opShiftRight : func = &rightShift_ai; break;
5833 case opShiftLeft : func = &leftShift_ai; break;
5834 case opRound : func = &round_ai; break;
5835 case opRoundUp : func = &roundUp_ai; break;
5836 case opTrunc : func = &trunc_ai; break;
5837 case opAtan2 : func = &atan2_ai; break;
5838 case opHypot : func = &hypot_ai; break;
5839 case opHypotx : func = &hypotx_ai; break;
5840 case opPow : func = &pow_ai; break;
5841 case opRing1 : func = &ring1_ai; break;
5842 case opRing2 : func = &ring2_ai; break;
5843 case opRing3 : func = &ring3_ai; break;
5844 case opRing4 : func = &ring4_ai; break;
5845 case opDifSqr : func = &difsqr_ai; break;
5846 case opSumSqr : func = &sumsqr_ai; break;
5847 case opSqrSum : func = &sqrsum_ai; break;
5848 case opSqrDif : func = &sqrdif_ai; break;
5849 case opAbsDif : func = &absdif_ai; break;
5850 case opThresh : func = &thresh_ai; break;
5851 case opAMClip : func = &amclip_ai; break;
5852 case opScaleNeg : func = &scaleneg_ai; break;
5853 case opClip2 : func = &clip2_ai; break;
5854 case opFold2 : func = &fold2_ai; break;
5855 case opWrap2 : func = &wrap2_ai; break;
5856 case opExcess : func = &excess_ai; break;
5857 case opFirstArg : func = &firstarg_aa; break;
5858 //case opSecondArg : func = &secondarg_aa; break;
5859 default : func = &add_ai; break;
5862 break;
5863 case calc_BufRate :
5864 if (rateB == calc_FullRate) {
5865 switch (unit->mSpecialIndex) {
5866 //case opSilence2 : func = &zero_aa; break;
5867 case opAdd : func = &add_ka; break;
5868 case opSub : func = &sub_ka; break;
5869 case opMul : func = &mul_ka; break;
5870 case opFDiv : func = &div_ka; break;
5871 case opMod : func = &mod_ka; break;
5872 case opEQ : func = &eq_ka; break;
5873 case opNE : func = &neq_ka; break;
5874 case opLT : func = &lt_ka; break;
5875 case opGT : func = &gt_ka; break;
5876 case opLE : func = &le_ka; break;
5877 case opGE : func = &ge_ka; break;
5878 case opMin : func = &min_ka; break;
5879 case opMax : func = &max_ka; break;
5880 case opBitAnd : func = &and_ka; break;
5881 case opBitOr : func = &or_ka; break;
5882 case opBitXor : func = &xor_ka; break;
5883 case opShiftRight : func = &rightShift_ka; break;
5884 case opShiftLeft : func = &leftShift_ka; break;
5885 case opRound : func = &round_ka; break;
5886 case opRoundUp : func = &roundUp_ka; break;
5887 case opTrunc : func = &trunc_ka; break;
5888 case opAtan2 : func = &atan2_ka; break;
5889 case opHypot : func = &hypot_ka; break;
5890 case opHypotx : func = &hypotx_ka; break;
5891 case opPow : func = &pow_ka; break;
5892 case opRing1 : func = &ring1_ka; break;
5893 case opRing2 : func = &ring2_ka; break;
5894 case opRing3 : func = &ring3_ka; break;
5895 case opRing4 : func = &ring4_ka; break;
5896 case opDifSqr : func = &difsqr_ka; break;
5897 case opSumSqr : func = &sumsqr_ka; break;
5898 case opSqrSum : func = &sqrsum_ka; break;
5899 case opSqrDif : func = &sqrdif_ka; break;
5900 case opAbsDif : func = &absdif_ka; break;
5901 case opThresh : func = &thresh_ka; break;
5902 case opAMClip : func = &amclip_ka; break;
5903 case opScaleNeg : func = &scaleneg_ka; break;
5904 case opClip2 : func = &clip2_ka; break;
5905 case opFold2 : func = &fold2_ka; break;
5906 case opWrap2 : func = &wrap2_ka; break;
5907 case opExcess : func = &excess_ka; break;
5908 //case opFirstArg : func = &firstarg_aa; break;
5909 //case opSecondArg : func = &secondarg_aa; break;
5910 default : func = &add_ka; break;
5912 } else {
5913 // this should have been caught by mBufLength == 1
5914 func = &zero_aa;
5916 break;
5917 case calc_ScalarRate :
5918 if (rateB == calc_FullRate) {
5919 switch (unit->mSpecialIndex) {
5920 //case opSilence2 : func = &zero_aa; break;
5921 case opAdd : func = &add_ia; break;
5922 case opSub : func = &sub_ia; break;
5923 case opMul : func = &mul_ia; break;
5924 case opFDiv : func = &div_ia; break;
5925 case opMod : func = &mod_ia; break;
5926 case opEQ : func = &eq_ia; break;
5927 case opNE : func = &neq_ia; break;
5928 case opLT : func = &lt_ia; break;
5929 case opGT : func = &gt_ia; break;
5930 case opLE : func = &le_ia; break;
5931 case opGE : func = &ge_ia; break;
5932 case opMin : func = &min_ia; break;
5933 case opMax : func = &max_ia; break;
5934 case opBitAnd : func = &and_ia; break;
5935 case opBitOr : func = &or_ia; break;
5936 case opBitXor : func = &xor_ia; break;
5937 case opShiftRight : func = &rightShift_ia; break;
5938 case opShiftLeft : func = &leftShift_ia; break;
5939 case opRound : func = &round_ia; break;
5940 case opRoundUp : func = &roundUp_ia; break;
5941 case opTrunc : func = &trunc_ia; break;
5942 case opAtan2 : func = &atan2_ia; break;
5943 case opHypot : func = &hypot_ia; break;
5944 case opHypotx : func = &hypotx_ia; break;
5945 case opPow : func = &pow_ia; break;
5946 case opRing1 : func = &ring1_ia; break;
5947 case opRing2 : func = &ring2_ia; break;
5948 case opRing3 : func = &ring3_ia; break;
5949 case opRing4 : func = &ring4_ia; break;
5950 case opDifSqr : func = &difsqr_ia; break;
5951 case opSumSqr : func = &sumsqr_ia; break;
5952 case opSqrSum : func = &sqrsum_ia; break;
5953 case opSqrDif : func = &sqrdif_ia; break;
5954 case opAbsDif : func = &absdif_ia; break;
5955 case opThresh : func = &thresh_ia; break;
5956 case opAMClip : func = &amclip_ia; break;
5957 case opScaleNeg : func = &scaleneg_ia; break;
5958 case opClip2 : func = &clip2_ia; break;
5959 case opFold2 : func = &fold2_ia; break;
5960 case opWrap2 : func = &wrap2_ia; break;
5961 case opExcess : func = &excess_ia; break;
5962 //case opFirstArg : func = &firstarg_aa; break;
5963 //case opSecondArg : func = &secondarg_aa; break;
5964 default : func = &add_ia; break;
5966 } else {
5967 // this should have been caught by mBufLength == 1
5968 func = &zero_aa;
5970 break;
5973 return func;
5976 #ifdef NOVA_SIMD
5977 static BinaryOpFunc ChooseNovaSimdFunc_64(BinaryOpUGen *unit)
5979 BinaryOpFunc func = &zero_1;
5981 int rateA = INRATE(0);
5982 int rateB = INRATE(1);
5984 switch (rateA) {
5985 case calc_FullRate:
5986 switch (rateB) {
5987 case calc_FullRate:
5988 switch (unit->mSpecialIndex) {
5989 //case opSilence2 : func = &zero_aa; break;
5990 case opAdd : func = &add_aa_nova_64; break;
5991 case opSub : func = &sub_aa_nova_64; break;
5992 case opMul : func = &mul_aa_nova_64; break;
5993 case opFDiv : func = &div_aa_nova; break;
5994 case opMod : func = &mod_aa; break;
5995 case opEQ : func = &eq_aa_nova_64; break;
5996 case opNE : func = &neq_aa_nova_64; break;
5997 case opLT : func = &lt_aa_nova_64; break;
5998 case opGT : func = &gt_aa_nova_64; break;
5999 case opLE : func = &le_aa_nova_64; break;
6000 case opGE : func = &ge_aa_nova_64; break;
6001 case opMin : func = &min_aa_nova_64; break;
6002 case opMax : func = &max_aa_nova_64; break;
6003 case opBitAnd : func = &and_aa; break;
6004 case opBitOr : func = &or_aa; break;
6005 case opBitXor : func = &xor_aa; break;
6006 case opShiftRight : func = &rightShift_aa; break;
6007 case opShiftLeft : func = &leftShift_aa; break;
6008 case opRound : func = &round_aa; break;
6009 case opRoundUp : func = &roundUp_aa; break;
6010 case opTrunc : func = &trunc_aa; break;
6011 case opAtan2 : func = &atan2_aa; break;
6012 case opHypot : func = &hypot_aa; break;
6013 case opHypotx : func = &hypotx_aa; break;
6014 case opPow : func = &pow_aa_nova; break;
6015 case opRing1 : func = &ring1_aa; break;
6016 case opRing2 : func = &ring2_aa; break;
6017 case opRing3 : func = &ring3_aa; break;
6018 case opRing4 : func = &ring4_aa; break;
6019 case opDifSqr : func = &difsqr_aa; break;
6020 case opSumSqr : func = &sumsqr_aa; break;
6021 case opSqrSum : func = &sqrsum_aa; break;
6022 case opSqrDif : func = &sqrdif_aa; break;
6023 case opAbsDif : func = &absdif_aa; break;
6024 case opThresh : func = &thresh_aa; break;
6025 case opAMClip : func = &amclip_aa; break;
6026 case opScaleNeg : func = &scaleneg_aa; break;
6027 case opClip2 : func = &clip2_aa_nova_64; break;
6028 case opFold2 : func = &fold2_aa; break;
6029 case opWrap2 : func = &wrap2_aa; break;
6030 case opExcess : func = &excess_aa; break;
6031 case opFirstArg : func = &firstarg_aa_nova; break;
6032 //case opSecondArg : func = &secondarg_aa_nova; break;
6033 default : func = &add_aa; break;
6035 break;
6036 case calc_BufRate :
6037 switch (unit->mSpecialIndex) {
6038 //case opSilence2 : func = &zero_aa; break;
6039 case opAdd : func = &add_ak_nova_64; break;
6040 case opSub : func = &sub_ak_nova_64; break;
6041 case opMul : func = &mul_ak_nova_64; break;
6042 case opFDiv : func = &div_ak_nova; break;
6043 case opMod : func = &mod_ak; break;
6044 case opEQ : func = &eq_ak_nova_64; break;
6045 case opNE : func = &neq_ak_nova_64; break;
6046 case opLT : func = &lt_ak_nova_64; break;
6047 case opGT : func = &gt_ak_nova_64; break;
6048 case opLE : func = &le_ak_nova_64; break;
6049 case opGE : func = &ge_ak_nova_64; break;
6050 case opMin : func = &min_ak_nova_64; break;
6051 case opMax : func = &max_ak_nova_64; break;
6052 case opBitAnd : func = &and_ak; break;
6053 case opBitOr : func = &or_ak; break;
6054 case opBitXor : func = &xor_ak; break;
6055 case opShiftRight : func = &rightShift_ak; break;
6056 case opShiftLeft : func = &leftShift_ak; break;
6057 case opRound : func = &round_ak; break;
6058 case opRoundUp : func = &roundUp_ak; break;
6059 case opTrunc : func = &trunc_ak; break;
6060 case opAtan2 : func = &atan2_ak; break;
6061 case opHypot : func = &hypot_ak; break;
6062 case opHypotx : func = &hypotx_ak; break;
6063 case opPow : func = &pow_ak_nova; break;
6064 case opRing1 : func = &ring1_ak; break;
6065 case opRing2 : func = &ring2_ak; break;
6066 case opRing3 : func = &ring3_ak; break;
6067 case opRing4 : func = &ring4_ak; break;
6068 case opDifSqr : func = &difsqr_ak; break;
6069 case opSumSqr : func = &sumsqr_ak; break;
6070 case opSqrSum : func = &sqrsum_ak; break;
6071 case opSqrDif : func = &sqrdif_ak; break;
6072 case opAbsDif : func = &absdif_ak; break;
6073 case opThresh : func = &thresh_ak; break;
6074 case opAMClip : func = &amclip_ak; break;
6075 case opScaleNeg : func = &scaleneg_ak; break;
6076 case opClip2 : func = &clip2_ak_nova_64; break;
6077 case opFold2 : func = &fold2_ak; break;
6078 case opWrap2 : func = &wrap2_ak; break;
6079 case opExcess : func = &excess_ak; break;
6080 case opFirstArg : func = &firstarg_aa; break;
6081 //case opSecondArg : func = &secondarg_aa; break;
6082 default : func = &add_ak; break;
6084 break;
6085 case calc_ScalarRate :
6086 switch (unit->mSpecialIndex) {
6087 //case opSilence2 : func = &zero_aa; break;
6088 case opAdd : func = &add_ai_nova_64; break;
6089 case opSub : func = &sub_ai_nova_64; break;
6090 case opMul : func = &mul_ai_nova_64; break;
6091 case opFDiv : func = &div_ai_nova; break;
6092 case opMod : func = &mod_ai; break;
6093 case opEQ : func = &eq_ai_nova_64; break;
6094 case opNE : func = &neq_ai_nova_64; break;
6095 case opLT : func = &lt_ai_nova_64; break;
6096 case opGT : func = &gt_ai_nova_64; break;
6097 case opLE : func = &le_ai_nova_64; break;
6098 case opGE : func = &ge_ai_nova_64; break;
6099 case opMin : func = &min_ai_nova_64; break;
6100 case opMax : func = &max_ai_nova_64; break;
6101 case opBitAnd : func = &and_ai; break;
6102 case opBitOr : func = &or_ai; break;
6103 case opBitXor : func = &xor_ai; break;
6104 case opShiftRight : func = &rightShift_ai; break;
6105 case opShiftLeft : func = &leftShift_ai; break;
6106 case opRound : func = &round_ai; break;
6107 case opRoundUp : func = &roundUp_ai; break;
6108 case opTrunc : func = &trunc_ai; break;
6109 case opAtan2 : func = &atan2_ai; break;
6110 case opHypot : func = &hypot_ai; break;
6111 case opHypotx : func = &hypotx_ai; break;
6112 case opPow : func = &pow_ai_nova; break;
6113 case opRing1 : func = &ring1_ai; break;
6114 case opRing2 : func = &ring2_ai; break;
6115 case opRing3 : func = &ring3_ai; break;
6116 case opRing4 : func = &ring4_ai; break;
6117 case opDifSqr : func = &difsqr_ai; break;
6118 case opSumSqr : func = &sumsqr_ai; break;
6119 case opSqrSum : func = &sqrsum_ai; break;
6120 case opSqrDif : func = &sqrdif_ai; break;
6121 case opAbsDif : func = &absdif_ai; break;
6122 case opThresh : func = &thresh_ai; break;
6123 case opAMClip : func = &amclip_ai; break;
6124 case opScaleNeg : func = &scaleneg_ai; break;
6125 case opClip2 : func = &clip2_ai_nova_64; break;
6126 case opFold2 : func = &fold2_ai; break;
6127 case opWrap2 : func = &wrap2_ai; break;
6128 case opExcess : func = &excess_ai; break;
6129 case opFirstArg : func = &firstarg_aa; break;
6130 //case opSecondArg : func = &secondarg_aa; break;
6131 default : func = &add_ai; break;
6134 break;
6135 case calc_BufRate :
6136 if (rateB == calc_FullRate) {
6137 switch (unit->mSpecialIndex) {
6138 //case opSilence2 : func = &zero_aa; break;
6139 case opAdd : func = &add_ka_nova_64; break;
6140 case opSub : func = &sub_ka_nova_64; break;
6141 case opMul : func = &mul_ka_nova_64; break;
6142 case opFDiv : func = &div_ka_nova; break;
6143 case opMod : func = &mod_ka; break;
6144 case opEQ : func = &eq_ka_nova_64; break;
6145 case opNE : func = &neq_ka_nova_64; break;
6146 case opLT : func = &lt_ka_nova_64; break;
6147 case opGT : func = &gt_ka_nova_64; break;
6148 case opLE : func = &le_ka_nova_64; break;
6149 case opGE : func = &ge_ka_nova_64; break;
6150 case opMin : func = &min_ka_nova_64; break;
6151 case opMax : func = &max_ka_nova_64; break;
6152 case opBitAnd : func = &and_ka; break;
6153 case opBitOr : func = &or_ka; break;
6154 case opBitXor : func = &xor_ka; break;
6155 case opShiftRight : func = &rightShift_ka; break;
6156 case opShiftLeft : func = &leftShift_ka; break;
6157 case opRound : func = &round_ka; break;
6158 case opRoundUp : func = &roundUp_ka; break;
6159 case opTrunc : func = &trunc_ka; break;
6160 case opAtan2 : func = &atan2_ka; break;
6161 case opHypot : func = &hypot_ka; break;
6162 case opHypotx : func = &hypotx_ka; break;
6163 case opPow : func = &pow_ka_nova; break;
6164 case opRing1 : func = &ring1_ka; break;
6165 case opRing2 : func = &ring2_ka; break;
6166 case opRing3 : func = &ring3_ka; break;
6167 case opRing4 : func = &ring4_ka; break;
6168 case opDifSqr : func = &difsqr_ka; break;
6169 case opSumSqr : func = &sumsqr_ka; break;
6170 case opSqrSum : func = &sqrsum_ka; break;
6171 case opSqrDif : func = &sqrdif_ka; break;
6172 case opAbsDif : func = &absdif_ka; break;
6173 case opThresh : func = &thresh_ka; break;
6174 case opAMClip : func = &amclip_ka; break;
6175 case opScaleNeg : func = &scaleneg_ka; break;
6176 case opClip2 : func = &clip2_ka_nova_64; break;
6177 case opFold2 : func = &fold2_ka; break;
6178 case opWrap2 : func = &wrap2_ka; break;
6179 case opExcess : func = &excess_ka; break;
6180 //case opFirstArg : func = &firstarg_aa; break;
6181 //case opSecondArg : func = &secondarg_aa; break;
6182 default : func = &add_ka; break;
6184 } else {
6185 // this should have been caught by mBufLength == 1
6186 func = &zero_aa;
6188 break;
6189 case calc_ScalarRate :
6190 if (rateB == calc_FullRate) {
6191 switch (unit->mSpecialIndex) {
6192 //case opSilence2 : func = &zero_aa; break;
6193 case opAdd : func = &add_ia_nova_64; break;
6194 case opSub : func = &sub_ia_nova_64; break;
6195 case opMul : func = &mul_ia_nova_64; break;
6196 case opFDiv : func = &div_ia_nova; break;
6197 case opMod : func = &mod_ia; break;
6198 case opEQ : func = &eq_ia_nova_64; break;
6199 case opNE : func = &neq_ia_nova_64; break;
6200 case opLT : func = &lt_ia_nova_64; break;
6201 case opGT : func = &gt_ia_nova_64; break;
6202 case opLE : func = &le_ia_nova_64; break;
6203 case opGE : func = &ge_ia_nova_64; break;
6204 case opMin : func = &min_ia_nova_64; break;
6205 case opMax : func = &max_ia_nova_64; break;
6206 case opBitAnd : func = &and_ia; break;
6207 case opBitOr : func = &or_ia; break;
6208 case opBitXor : func = &xor_ia; break;
6209 case opShiftRight : func = &rightShift_ia; break;
6210 case opShiftLeft : func = &leftShift_ia; break;
6211 case opRound : func = &round_ia; break;
6212 case opRoundUp : func = &roundUp_ia; break;
6213 case opTrunc : func = &trunc_ia; break;
6214 case opAtan2 : func = &atan2_ia; break;
6215 case opHypot : func = &hypot_ia; break;
6216 case opHypotx : func = &hypotx_ia; break;
6217 case opPow : func = &pow_ia_nova; break;
6218 case opRing1 : func = &ring1_ia; break;
6219 case opRing2 : func = &ring2_ia; break;
6220 case opRing3 : func = &ring3_ia; break;
6221 case opRing4 : func = &ring4_ia; break;
6222 case opDifSqr : func = &difsqr_ia; break;
6223 case opSumSqr : func = &sumsqr_ia; break;
6224 case opSqrSum : func = &sqrsum_ia; break;
6225 case opSqrDif : func = &sqrdif_ia; break;
6226 case opAbsDif : func = &absdif_ia; break;
6227 case opThresh : func = &thresh_ia; break;
6228 case opAMClip : func = &amclip_ia; break;
6229 case opScaleNeg : func = &scaleneg_ia; break;
6230 case opClip2 : func = &clip2_ia_nova_64; break;
6231 case opFold2 : func = &fold2_ia; break;
6232 case opWrap2 : func = &wrap2_ia; break;
6233 case opExcess : func = &excess_ia; break;
6234 //case opFirstArg : func = &firstarg_aa; break;
6235 //case opSecondArg : func = &secondarg_aa; break;
6236 default : func = &add_ia; break;
6238 } else {
6239 // this should have been caught by mBufLength == 1
6240 func = &zero_aa;
6242 break;
6245 return func;
6249 static BinaryOpFunc ChooseNovaSimdFunc(BinaryOpUGen *unit)
6251 if (BUFLENGTH == 64)
6252 return ChooseNovaSimdFunc_64(unit);
6254 BinaryOpFunc func = &zero_1;
6256 int rateA = INRATE(0);
6257 int rateB = INRATE(1);
6259 switch (rateA) {
6260 case calc_FullRate:
6261 switch (rateB) {
6262 case calc_FullRate:
6263 switch (unit->mSpecialIndex) {
6264 //case opSilence2 : func = &zero_aa; break;
6265 case opAdd : func = &add_aa_nova; break;
6266 case opSub : func = &sub_aa_nova; break;
6267 case opMul : func = &mul_aa_nova; break;
6268 case opFDiv : func = &div_aa_nova; break;
6269 case opMod : func = &mod_aa; break;
6270 case opEQ : func = &eq_aa_nova; break;
6271 case opNE : func = &neq_aa_nova; break;
6272 case opLT : func = &lt_aa_nova; break;
6273 case opGT : func = &gt_aa_nova; break;
6274 case opLE : func = &le_aa_nova; break;
6275 case opGE : func = &ge_aa_nova; break;
6276 case opMin : func = &min_aa_nova; break;
6277 case opMax : func = &max_aa_nova; break;
6278 case opBitAnd : func = &and_aa; break;
6279 case opBitOr : func = &or_aa; break;
6280 case opBitXor : func = &xor_aa; break;
6281 case opShiftRight : func = &rightShift_aa; break;
6282 case opShiftLeft : func = &leftShift_aa; break;
6283 case opRound : func = &round_aa; break;
6284 case opRoundUp : func = &roundUp_aa; break;
6285 case opTrunc : func = &trunc_aa; break;
6286 case opAtan2 : func = &atan2_aa; break;
6287 case opHypot : func = &hypot_aa; break;
6288 case opHypotx : func = &hypotx_aa; break;
6289 case opPow : func = &pow_aa_nova; break;
6290 case opRing1 : func = &ring1_aa; break;
6291 case opRing2 : func = &ring2_aa; break;
6292 case opRing3 : func = &ring3_aa; break;
6293 case opRing4 : func = &ring4_aa; break;
6294 case opDifSqr : func = &difsqr_aa; break;
6295 case opSumSqr : func = &sumsqr_aa; break;
6296 case opSqrSum : func = &sqrsum_aa; break;
6297 case opSqrDif : func = &sqrdif_aa; break;
6298 case opAbsDif : func = &absdif_aa; break;
6299 case opThresh : func = &thresh_aa; break;
6300 case opAMClip : func = &amclip_aa; break;
6301 case opScaleNeg : func = &scaleneg_aa; break;
6302 case opClip2 : func = &clip2_aa_nova; break;
6303 case opFold2 : func = &fold2_aa; break;
6304 case opWrap2 : func = &wrap2_aa; break;
6305 case opExcess : func = &excess_aa; break;
6306 case opFirstArg : func = &firstarg_aa_nova; break;
6307 //case opSecondArg : func = &secondarg_aa_nova; break;
6308 default : func = &add_aa; break;
6310 break;
6311 case calc_BufRate :
6312 switch (unit->mSpecialIndex) {
6313 //case opSilence2 : func = &zero_aa; break;
6314 case opAdd : func = &add_ak_nova; break;
6315 case opSub : func = &sub_ak_nova; break;
6316 case opMul : func = &mul_ak_nova; break;
6317 case opFDiv : func = &div_ak_nova; break;
6318 case opMod : func = &mod_ak; break;
6319 case opEQ : func = &eq_ak_nova; break;
6320 case opNE : func = &neq_ak_nova; break;
6321 case opLT : func = &lt_ak_nova; break;
6322 case opGT : func = &gt_ak_nova; break;
6323 case opLE : func = &le_ak_nova; break;
6324 case opGE : func = &ge_ak_nova; break;
6325 case opMin : func = &min_ak_nova; break;
6326 case opMax : func = &max_ak_nova; break;
6327 case opBitAnd : func = &and_ak; break;
6328 case opBitOr : func = &or_ak; break;
6329 case opBitXor : func = &xor_ak; break;
6330 case opShiftRight : func = &rightShift_ak; break;
6331 case opShiftLeft : func = &leftShift_ak; break;
6332 case opRound : func = &round_ak; break;
6333 case opRoundUp : func = &roundUp_ak; break;
6334 case opTrunc : func = &trunc_ak; break;
6335 case opAtan2 : func = &atan2_ak; break;
6336 case opHypot : func = &hypot_ak; break;
6337 case opHypotx : func = &hypotx_ak; break;
6338 case opPow : func = &pow_ak_nova; break;
6339 case opRing1 : func = &ring1_ak; break;
6340 case opRing2 : func = &ring2_ak; break;
6341 case opRing3 : func = &ring3_ak; break;
6342 case opRing4 : func = &ring4_ak; break;
6343 case opDifSqr : func = &difsqr_ak; break;
6344 case opSumSqr : func = &sumsqr_ak; break;
6345 case opSqrSum : func = &sqrsum_ak; break;
6346 case opSqrDif : func = &sqrdif_ak; break;
6347 case opAbsDif : func = &absdif_ak; break;
6348 case opThresh : func = &thresh_ak; break;
6349 case opAMClip : func = &amclip_ak; break;
6350 case opScaleNeg : func = &scaleneg_ak; break;
6351 case opClip2 : func = &clip2_ak_nova; break;
6352 case opFold2 : func = &fold2_ak; break;
6353 case opWrap2 : func = &wrap2_ak; break;
6354 case opExcess : func = &excess_ak; break;
6355 case opFirstArg : func = &firstarg_aa; break;
6356 //case opSecondArg : func = &secondarg_aa; break;
6357 default : func = &add_ak; break;
6359 break;
6360 case calc_ScalarRate :
6361 switch (unit->mSpecialIndex) {
6362 //case opSilence2 : func = &zero_aa; break;
6363 case opAdd : func = &add_ai_nova; break;
6364 case opSub : func = &sub_ai_nova; break;
6365 case opMul : func = &mul_ai_nova; break;
6366 case opFDiv : func = &div_ai_nova; break;
6367 case opMod : func = &mod_ai; break;
6368 case opEQ : func = &eq_ai_nova; break;
6369 case opNE : func = &neq_ai_nova; break;
6370 case opLT : func = &lt_ai_nova; break;
6371 case opGT : func = &gt_ai_nova; break;
6372 case opLE : func = &le_ai_nova; break;
6373 case opGE : func = &ge_ai_nova; break;
6374 case opMin : func = &min_ai_nova; break;
6375 case opMax : func = &max_ai_nova; break;
6376 case opBitAnd : func = &and_ai; break;
6377 case opBitOr : func = &or_ai; break;
6378 case opBitXor : func = &xor_ai; break;
6379 case opShiftRight : func = &rightShift_ai; break;
6380 case opShiftLeft : func = &leftShift_ai; break;
6381 case opRound : func = &round_ai; break;
6382 case opRoundUp : func = &roundUp_ai; break;
6383 case opTrunc : func = &trunc_ai; break;
6384 case opAtan2 : func = &atan2_ai; break;
6385 case opHypot : func = &hypot_ai; break;
6386 case opHypotx : func = &hypotx_ai; break;
6387 case opPow : func = &pow_ai_nova; break;
6388 case opRing1 : func = &ring1_ai; break;
6389 case opRing2 : func = &ring2_ai; break;
6390 case opRing3 : func = &ring3_ai; break;
6391 case opRing4 : func = &ring4_ai; break;
6392 case opDifSqr : func = &difsqr_ai; break;
6393 case opSumSqr : func = &sumsqr_ai; break;
6394 case opSqrSum : func = &sqrsum_ai; break;
6395 case opSqrDif : func = &sqrdif_ai; break;
6396 case opAbsDif : func = &absdif_ai; break;
6397 case opThresh : func = &thresh_ai; break;
6398 case opAMClip : func = &amclip_ai; break;
6399 case opScaleNeg : func = &scaleneg_ai; break;
6400 case opClip2 : func = &clip2_ai_nova; break;
6401 case opFold2 : func = &fold2_ai; break;
6402 case opWrap2 : func = &wrap2_ai; break;
6403 case opExcess : func = &excess_ai; break;
6404 case opFirstArg : func = &firstarg_aa; break;
6405 //case opSecondArg : func = &secondarg_aa; break;
6406 default : func = &add_ai; break;
6409 break;
6410 case calc_BufRate :
6411 if (rateB == calc_FullRate) {
6412 switch (unit->mSpecialIndex) {
6413 //case opSilence2 : func = &zero_aa; break;
6414 case opAdd : func = &add_ka_nova; break;
6415 case opSub : func = &sub_ka_nova; break;
6416 case opMul : func = &mul_ka_nova; break;
6417 case opFDiv : func = &div_ka_nova; break;
6418 case opMod : func = &mod_ka; break;
6419 case opEQ : func = &eq_ka_nova; break;
6420 case opNE : func = &neq_ka_nova; break;
6421 case opLT : func = &lt_ka_nova; break;
6422 case opGT : func = &gt_ka_nova; break;
6423 case opLE : func = &le_ka_nova; break;
6424 case opGE : func = &ge_ka_nova; break;
6425 case opMin : func = &min_ka_nova; break;
6426 case opMax : func = &max_ka_nova; break;
6427 case opBitAnd : func = &and_ka; break;
6428 case opBitOr : func = &or_ka; break;
6429 case opBitXor : func = &xor_ka; break;
6430 case opShiftRight : func = &rightShift_ka; break;
6431 case opShiftLeft : func = &leftShift_ka; break;
6432 case opRound : func = &round_ka; break;
6433 case opRoundUp : func = &roundUp_ka; break;
6434 case opTrunc : func = &trunc_ka; break;
6435 case opAtan2 : func = &atan2_ka; break;
6436 case opHypot : func = &hypot_ka; break;
6437 case opHypotx : func = &hypotx_ka; break;
6438 case opPow : func = &pow_ka_nova; break;
6439 case opRing1 : func = &ring1_ka; break;
6440 case opRing2 : func = &ring2_ka; break;
6441 case opRing3 : func = &ring3_ka; break;
6442 case opRing4 : func = &ring4_ka; break;
6443 case opDifSqr : func = &difsqr_ka; break;
6444 case opSumSqr : func = &sumsqr_ka; break;
6445 case opSqrSum : func = &sqrsum_ka; break;
6446 case opSqrDif : func = &sqrdif_ka; break;
6447 case opAbsDif : func = &absdif_ka; break;
6448 case opThresh : func = &thresh_ka; break;
6449 case opAMClip : func = &amclip_ka; break;
6450 case opScaleNeg : func = &scaleneg_ka; break;
6451 case opClip2 : func = &clip2_ka_nova; break;
6452 case opFold2 : func = &fold2_ka; break;
6453 case opWrap2 : func = &wrap2_ka; break;
6454 case opExcess : func = &excess_ka; break;
6455 //case opFirstArg : func = &firstarg_aa; break;
6456 //case opSecondArg : func = &secondarg_aa; break;
6457 default : func = &add_ka; break;
6459 } else {
6460 // this should have been caught by mBufLength == 1
6461 func = &zero_aa;
6463 break;
6464 case calc_ScalarRate :
6465 if (rateB == calc_FullRate) {
6466 switch (unit->mSpecialIndex) {
6467 //case opSilence2 : func = &zero_aa; break;
6468 case opAdd : func = &add_ia_nova; break;
6469 case opSub : func = &sub_ia_nova; break;
6470 case opMul : func = &mul_ia_nova; break;
6471 case opFDiv : func = &div_ia_nova; break;
6472 case opMod : func = &mod_ia; break;
6473 case opEQ : func = &eq_ia_nova; break;
6474 case opNE : func = &neq_ia_nova; break;
6475 case opLT : func = &lt_ia_nova; break;
6476 case opGT : func = &gt_ia_nova; break;
6477 case opLE : func = &le_ia_nova; break;
6478 case opGE : func = &ge_ia_nova; break;
6479 case opMin : func = &min_ia_nova; break;
6480 case opMax : func = &max_ia_nova; break;
6481 case opBitAnd : func = &and_ia; break;
6482 case opBitOr : func = &or_ia; break;
6483 case opBitXor : func = &xor_ia; break;
6484 case opShiftRight : func = &rightShift_ia; break;
6485 case opShiftLeft : func = &leftShift_ia; break;
6486 case opRound : func = &round_ia; break;
6487 case opRoundUp : func = &roundUp_ia; break;
6488 case opTrunc : func = &trunc_ia; break;
6489 case opAtan2 : func = &atan2_ia; break;
6490 case opHypot : func = &hypot_ia; break;
6491 case opHypotx : func = &hypotx_ia; break;
6492 case opPow : func = &pow_ia_nova; break;
6493 case opRing1 : func = &ring1_ia; break;
6494 case opRing2 : func = &ring2_ia; break;
6495 case opRing3 : func = &ring3_ia; break;
6496 case opRing4 : func = &ring4_ia; break;
6497 case opDifSqr : func = &difsqr_ia; break;
6498 case opSumSqr : func = &sumsqr_ia; break;
6499 case opSqrSum : func = &sqrsum_ia; break;
6500 case opSqrDif : func = &sqrdif_ia; break;
6501 case opAbsDif : func = &absdif_ia; break;
6502 case opThresh : func = &thresh_ia; break;
6503 case opAMClip : func = &amclip_ia; break;
6504 case opScaleNeg : func = &scaleneg_ia; break;
6505 case opClip2 : func = &clip2_ia_nova; break;
6506 case opFold2 : func = &fold2_ia; break;
6507 case opWrap2 : func = &wrap2_ia; break;
6508 case opExcess : func = &excess_ia; break;
6509 //case opFirstArg : func = &firstarg_aa; break;
6510 //case opSecondArg : func = &secondarg_aa; break;
6511 default : func = &add_ia; break;
6513 } else {
6514 // this should have been caught by mBufLength == 1
6515 func = &zero_aa;
6517 break;
6520 return func;
6523 #endif
6525 bool ChooseOperatorFunc(BinaryOpUGen *unit)
6527 //Print("->ChooseOperatorFunc %d\n", unit->mSpecialIndex);
6528 BinaryOpFunc func = &zero_aa;
6529 bool ret = false;
6531 if (BUFLENGTH == 1) {
6532 if (unit->mCalcRate == calc_DemandRate) {
6533 func = ChooseDemandFunc(unit);
6534 } else {
6535 func = ChooseOneSampleFunc(unit);
6537 #if defined(NOVA_SIMD)
6538 } else if (!(BUFLENGTH & 15)) {
6539 /* select normal function for initialization */
6540 func = ChooseNormalFunc(unit);
6541 func(unit, 1);
6543 /* select simd function */
6544 func = ChooseNovaSimdFunc(unit);
6545 ret = true;
6546 #endif
6547 } else {
6548 func = ChooseNormalFunc(unit);
6550 unit->mCalcFunc = (UnitCalcFunc)func;
6551 //Print("<-ChooseOperatorFunc %p\n", func);
6552 //Print("calc %d\n", unit->mCalcRate);
6553 return ret;
6559 ////////////////////////////////////////////////////////////////////////////////////////////////////////
6562 PluginLoad(BinaryOp)
6564 ft = inTable;
6566 DefineSimpleUnit(BinaryOpUGen);