Merge pull request #506 from andrewcsmith/patch-2
[supercollider.git] / server / plugins / BinaryOpUGens.cpp
blob8f03dbe504cc206ef65d2a012594f0d054715c04
1 /*
2 SuperCollider real time audio synthesis system
3 Copyright (c) 2002 James McCartney. All rights reserved.
4 http://www.audiosynth.com
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 #include "SC_PlugIn.h"
25 #ifdef _MSC_VER
26 // hypotf is c99, but not c++
27 #define hypotf _hypotf
28 #endif
30 #ifdef NOVA_SIMD
31 #include "simd_binary_arithmetic.hpp"
32 #include "simd_math.hpp"
33 #include "simd_memory.hpp"
36 #include "function_attributes.h"
37 using nova::slope_argument;
39 #define NOVA_BINARY_WRAPPER(SCNAME, NOVANAME) \
40 FLATTEN void SCNAME##_aa_nova(BinaryOpUGen *unit, int inNumSamples) \
41 { \
42 nova::NOVANAME##_vec_simd(OUT(0), IN(0), IN(1), inNumSamples); \
43 } \
45 FLATTEN void SCNAME##_aa_nova_64(BinaryOpUGen *unit, int inNumSamples) \
46 { \
47 nova::NOVANAME##_vec_simd<64>(OUT(0), IN(0), IN(1)); \
48 } \
50 FLATTEN void SCNAME##_ia_nova(BinaryOpUGen *unit, int inNumSamples) \
51 { \
52 float xa = ZIN0(0); \
54 nova::NOVANAME##_vec_simd(OUT(0), xa, IN(1), inNumSamples); \
55 unit->mPrevA = xa; \
56 } \
58 FLATTEN void SCNAME##_ia_nova_64(BinaryOpUGen *unit, int inNumSamples) \
59 { \
60 float xa = ZIN0(0); \
62 nova::NOVANAME##_vec_simd<64>(OUT(0), xa, IN(1)); \
63 unit->mPrevA = xa; \
64 } \
66 FLATTEN void SCNAME##_ai_nova(BinaryOpUGen *unit, int inNumSamples) \
67 { \
68 float xb = ZIN0(1); \
70 nova::NOVANAME##_vec_simd(OUT(0), IN(0), xb, inNumSamples); \
71 unit->mPrevB = xb; \
72 } \
74 FLATTEN void SCNAME##_ai_nova_64(BinaryOpUGen *unit, int inNumSamples) \
75 { \
76 float xb = ZIN0(1); \
78 nova::NOVANAME##_vec_simd<64>(OUT(0), IN(0), xb); \
79 unit->mPrevB = xb; \
82 #define NOVA_BINARY_WRAPPER_K(SCNAME, NOVANAME) \
83 FLATTEN void SCNAME##_aa_nova(BinaryOpUGen *unit, int inNumSamples) \
84 { \
85 nova::NOVANAME##_vec_simd(OUT(0), IN(0), IN(1), inNumSamples); \
86 } \
88 FLATTEN void SCNAME##_aa_nova_64(BinaryOpUGen *unit, int inNumSamples) \
89 { \
90 nova::NOVANAME##_vec_simd<64>(OUT(0), IN(0), IN(1)); \
91 } \
93 FLATTEN void SCNAME##_ia_nova(BinaryOpUGen *unit, int inNumSamples) \
94 { \
95 float xa = ZIN0(0); \
97 nova::NOVANAME##_vec_simd(OUT(0), xa, IN(1), inNumSamples); \
98 unit->mPrevA = xa; \
99 } \
101 FLATTEN void SCNAME##_ia_nova_64(BinaryOpUGen *unit, int inNumSamples) \
103 float xa = ZIN0(0); \
105 nova::NOVANAME##_vec_simd<64>(OUT(0), xa, IN(1)); \
106 unit->mPrevA = xa; \
109 FLATTEN void SCNAME##_ai_nova(BinaryOpUGen *unit, int inNumSamples) \
111 float xb = ZIN0(1); \
113 nova::NOVANAME##_vec_simd(OUT(0), IN(0), xb, inNumSamples); \
114 unit->mPrevB = xb; \
117 FLATTEN void SCNAME##_ai_nova_64(BinaryOpUGen *unit, int inNumSamples) \
119 float xb = ZIN0(1); \
121 nova::NOVANAME##_vec_simd<64>(OUT(0), IN(0), xb); \
122 unit->mPrevB = xb; \
125 FLATTEN void SCNAME##_ak_nova(BinaryOpUGen *unit, int inNumSamples) \
127 float xb = unit->mPrevB; \
128 float next_b = ZIN0(1); \
130 if (xb == next_b) { \
131 nova::NOVANAME##_vec_simd(OUT(0), IN(0), xb, inNumSamples); \
132 } else { \
133 float slope = CALCSLOPE(next_b, xb); \
134 nova::NOVANAME##_vec_simd(OUT(0), IN(0), slope_argument(xb, slope), inNumSamples); \
135 unit->mPrevB = next_b; \
139 FLATTEN void SCNAME##_ak_nova_64(BinaryOpUGen *unit, int inNumSamples) \
141 float xb = unit->mPrevB; \
142 float next_b = ZIN0(1); \
144 if (xb == next_b) { \
145 nova::NOVANAME##_vec_simd<64>(OUT(0), IN(0), xb); \
146 } else { \
147 float slope = CALCSLOPE(next_b, xb); \
148 nova::NOVANAME##_vec_simd(OUT(0), IN(0), slope_argument(xb, slope), inNumSamples); \
149 unit->mPrevB = next_b; \
153 FLATTEN void SCNAME##_ka_nova(BinaryOpUGen *unit, int inNumSamples) \
155 float xa = unit->mPrevA; \
156 float next_a = ZIN0(0); \
158 if (xa == next_a) { \
159 nova::NOVANAME##_vec_simd(OUT(0), xa, IN(1), inNumSamples); \
160 } else { \
161 float slope = CALCSLOPE(next_a, xa); \
162 nova::NOVANAME##_vec_simd(OUT(0), slope_argument(xa, slope), IN(1), inNumSamples); \
163 unit->mPrevA = next_a; \
166 FLATTEN void SCNAME##_ka_nova_64(BinaryOpUGen *unit, int inNumSamples) \
168 float xa = unit->mPrevA; \
169 float next_a = ZIN0(0); \
171 if (xa == next_a) { \
172 nova::NOVANAME##_vec_simd<64>(OUT(0), xa, IN(1)); \
173 } else { \
174 float slope = CALCSLOPE(next_a, xa); \
175 nova::NOVANAME##_vec_simd(OUT(0), slope_argument(xa, slope), IN(1), inNumSamples); \
176 unit->mPrevA = next_a; \
181 #endif
183 using namespace std; // for math functions
185 static InterfaceTable *ft;
187 //////////////////////////////////////////////////////////////////////////////////////////////////
190 /* special binary math operators */
191 enum {
192 opAdd,
193 opSub,
194 opMul,
195 opIDiv,
196 opFDiv,
197 opMod,
198 opEQ,
199 opNE,
200 opLT,
201 opGT,
202 opLE,
203 opGE,
204 //opIdentical,
205 //opNotIdentical,
207 opMin,
208 opMax,
209 opBitAnd,
210 opBitOr,
211 opBitXor,
212 opLCM,
213 opGCD,
214 opRound,
215 opRoundUp,
216 opTrunc,
217 opAtan2,
218 opHypot,
219 opHypotx,
220 opPow,
221 opShiftLeft, //
222 opShiftRight, //
223 opUnsignedShift, //
224 opFill, //
225 opRing1, // a * (b + 1) == a * b + a
226 opRing2, // a * b + a + b
227 opRing3, // a*a*b
228 opRing4, // a*a*b - a*b*b
229 opDifSqr, // a*a - b*b
230 opSumSqr, // a*a + b*b
231 opSqrSum, // (a + b)^2
232 opSqrDif, // (a - b)^2
233 opAbsDif, // |a - b|
234 opThresh,
235 opAMClip,
236 opScaleNeg,
237 opClip2,
238 opExcess,
239 opFold2,
240 opWrap2,
241 opFirstArg,
242 opRandRange,
243 opExpRandRange,
245 opNumBinarySelectors
249 inline float sc_andt(float a, float b)
251 return int(a) & int(b);
254 inline float sc_ort(float a, float b)
256 return int(a) | int(b);
259 inline float sc_xort(float a, float b)
261 return int(a) ^ int(b);
264 inline float sc_rst(float a, float b)
266 return int(a) >> int(b);
269 inline float sc_lst(float a, float b)
271 return int(a) << int(b);
274 struct BinaryOpUGen : public Unit
276 float mPrevA, mPrevB;
279 typedef void (*BinaryOpFunc)(BinaryOpUGen *unit, int inNumSamples);
281 extern "C"
284 void BinaryOpUGen_Ctor(BinaryOpUGen *unit);
286 //void zero_d(BinaryOpUGen *unit, int inNumSamples);
287 void zero_1(BinaryOpUGen *unit, int inNumSamples);
288 void zero_aa(BinaryOpUGen *unit, int inNumSamples);
289 void firstarg_d(BinaryOpUGen *unit, int inNumSamples);
290 void firstarg_1(BinaryOpUGen *unit, int inNumSamples);
291 void firstarg_aa(BinaryOpUGen *unit, int inNumSamples);
292 void secondarg_d(BinaryOpUGen *unit, int inNumSamples);
293 void secondarg_1(BinaryOpUGen *unit, int inNumSamples);
294 void secondarg_aa(BinaryOpUGen *unit, int inNumSamples);
295 void add_d(BinaryOpUGen *unit, int inNumSamples);
296 void add_1(BinaryOpUGen *unit, int inNumSamples);
297 void add_aa(BinaryOpUGen *unit, int inNumSamples);
298 void add_ak(BinaryOpUGen *unit, int inNumSamples);
299 void add_ka(BinaryOpUGen *unit, int inNumSamples);
300 void add_ai(BinaryOpUGen *unit, int inNumSamples);
301 void add_ia(BinaryOpUGen *unit, int inNumSamples);
302 void sub_d(BinaryOpUGen *unit, int inNumSamples);
303 void sub_1(BinaryOpUGen *unit, int inNumSamples);
304 void sub_aa(BinaryOpUGen *unit, int inNumSamples);
305 void sub_ak(BinaryOpUGen *unit, int inNumSamples);
306 void sub_ka(BinaryOpUGen *unit, int inNumSamples);
307 void sub_ai(BinaryOpUGen *unit, int inNumSamples);
308 void sub_ia(BinaryOpUGen *unit, int inNumSamples);
309 void mul_d(BinaryOpUGen *unit, int inNumSamples);
310 void mul_1(BinaryOpUGen *unit, int inNumSamples);
311 void mul_aa(BinaryOpUGen *unit, int inNumSamples);
312 void mul_ak(BinaryOpUGen *unit, int inNumSamples);
313 void mul_ka(BinaryOpUGen *unit, int inNumSamples);
314 void mul_ai(BinaryOpUGen *unit, int inNumSamples);
315 void mul_ia(BinaryOpUGen *unit, int inNumSamples);
316 void div_d(BinaryOpUGen *unit, int inNumSamples);
317 void div_1(BinaryOpUGen *unit, int inNumSamples);
318 void div_aa(BinaryOpUGen *unit, int inNumSamples);
319 void div_ak(BinaryOpUGen *unit, int inNumSamples);
320 void div_ka(BinaryOpUGen *unit, int inNumSamples);
321 void div_ai(BinaryOpUGen *unit, int inNumSamples);
322 void div_ia(BinaryOpUGen *unit, int inNumSamples);
323 void mod_d(BinaryOpUGen *unit, int inNumSamples);
324 void mod_1(BinaryOpUGen *unit, int inNumSamples);
325 void mod_aa(BinaryOpUGen *unit, int inNumSamples);
326 void mod_ak(BinaryOpUGen *unit, int inNumSamples);
327 void mod_ka(BinaryOpUGen *unit, int inNumSamples);
328 void mod_ai(BinaryOpUGen *unit, int inNumSamples);
329 void mod_ia(BinaryOpUGen *unit, int inNumSamples);
330 void max_d(BinaryOpUGen *unit, int inNumSamples);
331 void max_1(BinaryOpUGen *unit, int inNumSamples);
332 void max_aa(BinaryOpUGen *unit, int inNumSamples);
333 void max_ak(BinaryOpUGen *unit, int inNumSamples);
334 void max_ka(BinaryOpUGen *unit, int inNumSamples);
335 void max_ai(BinaryOpUGen *unit, int inNumSamples);
336 void max_ia(BinaryOpUGen *unit, int inNumSamples);
337 void min_d(BinaryOpUGen *unit, int inNumSamples);
338 void min_1(BinaryOpUGen *unit, int inNumSamples);
339 void min_aa(BinaryOpUGen *unit, int inNumSamples);
340 void min_ak(BinaryOpUGen *unit, int inNumSamples);
341 void min_ka(BinaryOpUGen *unit, int inNumSamples);
342 void min_ai(BinaryOpUGen *unit, int inNumSamples);
343 void min_ia(BinaryOpUGen *unit, int inNumSamples);
345 void and_d(BinaryOpUGen *unit, int inNumSamples);
346 void and_1(BinaryOpUGen *unit, int inNumSamples);
347 void and_aa(BinaryOpUGen *unit, int inNumSamples);
348 void and_ak(BinaryOpUGen *unit, int inNumSamples);
349 void and_ka(BinaryOpUGen *unit, int inNumSamples);
350 void and_ai(BinaryOpUGen *unit, int inNumSamples);
351 void and_ia(BinaryOpUGen *unit, int inNumSamples);
353 void or_d(BinaryOpUGen *unit, int inNumSamples);
354 void or_1(BinaryOpUGen *unit, int inNumSamples);
355 void or_aa(BinaryOpUGen *unit, int inNumSamples);
356 void or_ak(BinaryOpUGen *unit, int inNumSamples);
357 void or_ka(BinaryOpUGen *unit, int inNumSamples);
358 void or_ai(BinaryOpUGen *unit, int inNumSamples);
359 void or_ia(BinaryOpUGen *unit, int inNumSamples);
361 void xor_d(BinaryOpUGen *unit, int inNumSamples);
362 void xor_1(BinaryOpUGen *unit, int inNumSamples);
363 void xor_aa(BinaryOpUGen *unit, int inNumSamples);
364 void xor_ak(BinaryOpUGen *unit, int inNumSamples);
365 void xor_ka(BinaryOpUGen *unit, int inNumSamples);
366 void xor_ai(BinaryOpUGen *unit, int inNumSamples);
367 void xor_ia(BinaryOpUGen *unit, int inNumSamples);
369 void amclip_d(BinaryOpUGen *unit, int inNumSamples);
370 void amclip_1(BinaryOpUGen *unit, int inNumSamples);
371 void amclip_aa(BinaryOpUGen *unit, int inNumSamples);
372 void amclip_ak(BinaryOpUGen *unit, int inNumSamples);
373 void amclip_ka(BinaryOpUGen *unit, int inNumSamples);
374 void amclip_ai(BinaryOpUGen *unit, int inNumSamples);
375 void amclip_ia(BinaryOpUGen *unit, int inNumSamples);
376 void scaleneg_d(BinaryOpUGen *unit, int inNumSamples);
377 void scaleneg_1(BinaryOpUGen *unit, int inNumSamples);
378 void scaleneg_aa(BinaryOpUGen *unit, int inNumSamples);
379 void scaleneg_ak(BinaryOpUGen *unit, int inNumSamples);
380 void scaleneg_ka(BinaryOpUGen *unit, int inNumSamples);
381 void scaleneg_ai(BinaryOpUGen *unit, int inNumSamples);
382 void scaleneg_ia(BinaryOpUGen *unit, int inNumSamples);
383 void pow_d(BinaryOpUGen *unit, int inNumSamples);
384 void pow_1(BinaryOpUGen *unit, int inNumSamples);
385 void pow_aa(BinaryOpUGen *unit, int inNumSamples);
386 void pow_ak(BinaryOpUGen *unit, int inNumSamples);
387 void pow_ka(BinaryOpUGen *unit, int inNumSamples);
388 void pow_ai(BinaryOpUGen *unit, int inNumSamples);
389 void pow_ia(BinaryOpUGen *unit, int inNumSamples);
390 void ring1_d(BinaryOpUGen *unit, int inNumSamples);
391 void ring1_1(BinaryOpUGen *unit, int inNumSamples);
392 void ring1_aa(BinaryOpUGen *unit, int inNumSamples);
393 void ring1_ak(BinaryOpUGen *unit, int inNumSamples);
394 void ring1_ka(BinaryOpUGen *unit, int inNumSamples);
395 void ring1_ai(BinaryOpUGen *unit, int inNumSamples);
396 void ring1_ia(BinaryOpUGen *unit, int inNumSamples);
397 void ring2_d(BinaryOpUGen *unit, int inNumSamples);
398 void ring2_1(BinaryOpUGen *unit, int inNumSamples);
399 void ring2_aa(BinaryOpUGen *unit, int inNumSamples);
400 void ring2_ak(BinaryOpUGen *unit, int inNumSamples);
401 void ring2_ka(BinaryOpUGen *unit, int inNumSamples);
402 void ring2_ai(BinaryOpUGen *unit, int inNumSamples);
403 void ring2_ia(BinaryOpUGen *unit, int inNumSamples);
404 void ring3_d(BinaryOpUGen *unit, int inNumSamples);
405 void ring3_1(BinaryOpUGen *unit, int inNumSamples);
406 void ring3_aa(BinaryOpUGen *unit, int inNumSamples);
407 void ring3_ak(BinaryOpUGen *unit, int inNumSamples);
408 void ring3_ka(BinaryOpUGen *unit, int inNumSamples);
409 void ring3_ai(BinaryOpUGen *unit, int inNumSamples);
410 void ring3_ia(BinaryOpUGen *unit, int inNumSamples);
411 void ring4_d(BinaryOpUGen *unit, int inNumSamples);
412 void ring4_1(BinaryOpUGen *unit, int inNumSamples);
413 void ring4_aa(BinaryOpUGen *unit, int inNumSamples);
414 void ring4_ak(BinaryOpUGen *unit, int inNumSamples);
415 void ring4_ka(BinaryOpUGen *unit, int inNumSamples);
416 void ring4_ai(BinaryOpUGen *unit, int inNumSamples);
417 void ring4_ia(BinaryOpUGen *unit, int inNumSamples);
418 void thresh_d(BinaryOpUGen *unit, int inNumSamples);
419 void thresh_1(BinaryOpUGen *unit, int inNumSamples);
420 void thresh_aa(BinaryOpUGen *unit, int inNumSamples);
421 void thresh_ak(BinaryOpUGen *unit, int inNumSamples);
422 void thresh_ka(BinaryOpUGen *unit, int inNumSamples);
423 void thresh_ai(BinaryOpUGen *unit, int inNumSamples);
424 void thresh_ia(BinaryOpUGen *unit, int inNumSamples);
425 void clip2_d(BinaryOpUGen *unit, int inNumSamples);
426 void clip2_1(BinaryOpUGen *unit, int inNumSamples);
427 void clip2_aa(BinaryOpUGen *unit, int inNumSamples);
428 void clip2_ak(BinaryOpUGen *unit, int inNumSamples);
429 void clip2_ka(BinaryOpUGen *unit, int inNumSamples);
430 void clip2_ai(BinaryOpUGen *unit, int inNumSamples);
431 void clip2_ia(BinaryOpUGen *unit, int inNumSamples);
432 void fold2_d(BinaryOpUGen *unit, int inNumSamples);
433 void fold2_1(BinaryOpUGen *unit, int inNumSamples);
434 void fold2_aa(BinaryOpUGen *unit, int inNumSamples);
435 void fold2_ak(BinaryOpUGen *unit, int inNumSamples);
436 void fold2_ka(BinaryOpUGen *unit, int inNumSamples);
437 void fold2_ai(BinaryOpUGen *unit, int inNumSamples);
438 void fold2_ia(BinaryOpUGen *unit, int inNumSamples);
439 void wrap2_d(BinaryOpUGen *unit, int inNumSamples);
440 void wrap2_1(BinaryOpUGen *unit, int inNumSamples);
441 void wrap2_aa(BinaryOpUGen *unit, int inNumSamples);
442 void wrap2_ak(BinaryOpUGen *unit, int inNumSamples);
443 void wrap2_ka(BinaryOpUGen *unit, int inNumSamples);
444 void wrap2_ai(BinaryOpUGen *unit, int inNumSamples);
445 void wrap2_ia(BinaryOpUGen *unit, int inNumSamples);
446 void excess_d(BinaryOpUGen *unit, int inNumSamples);
447 void excess_1(BinaryOpUGen *unit, int inNumSamples);
448 void excess_aa(BinaryOpUGen *unit, int inNumSamples);
449 void excess_ak(BinaryOpUGen *unit, int inNumSamples);
450 void excess_ka(BinaryOpUGen *unit, int inNumSamples);
451 void excess_ai(BinaryOpUGen *unit, int inNumSamples);
452 void excess_ia(BinaryOpUGen *unit, int inNumSamples);
453 void lt_d(BinaryOpUGen *unit, int inNumSamples);
454 void lt_1(BinaryOpUGen *unit, int inNumSamples);
455 void lt_aa(BinaryOpUGen *unit, int inNumSamples);
456 void lt_ak(BinaryOpUGen *unit, int inNumSamples);
457 void lt_ka(BinaryOpUGen *unit, int inNumSamples);
458 void lt_ai(BinaryOpUGen *unit, int inNumSamples);
459 void lt_ia(BinaryOpUGen *unit, int inNumSamples);
460 void le_d(BinaryOpUGen *unit, int inNumSamples);
461 void le_1(BinaryOpUGen *unit, int inNumSamples);
462 void le_aa(BinaryOpUGen *unit, int inNumSamples);
463 void le_ak(BinaryOpUGen *unit, int inNumSamples);
464 void le_ka(BinaryOpUGen *unit, int inNumSamples);
465 void le_ai(BinaryOpUGen *unit, int inNumSamples);
466 void le_ia(BinaryOpUGen *unit, int inNumSamples);
467 void gt_d(BinaryOpUGen *unit, int inNumSamples);
468 void gt_1(BinaryOpUGen *unit, int inNumSamples);
469 void gt_aa(BinaryOpUGen *unit, int inNumSamples);
470 void gt_ak(BinaryOpUGen *unit, int inNumSamples);
471 void gt_ka(BinaryOpUGen *unit, int inNumSamples);
472 void gt_ai(BinaryOpUGen *unit, int inNumSamples);
473 void gt_ia(BinaryOpUGen *unit, int inNumSamples);
474 void ge_d(BinaryOpUGen *unit, int inNumSamples);
475 void ge_1(BinaryOpUGen *unit, int inNumSamples);
476 void ge_aa(BinaryOpUGen *unit, int inNumSamples);
477 void ge_ak(BinaryOpUGen *unit, int inNumSamples);
478 void ge_ka(BinaryOpUGen *unit, int inNumSamples);
479 void ge_ai(BinaryOpUGen *unit, int inNumSamples);
480 void ge_ia(BinaryOpUGen *unit, int inNumSamples);
481 void eq_d(BinaryOpUGen *unit, int inNumSamples);
482 void eq_1(BinaryOpUGen *unit, int inNumSamples);
483 void eq_aa(BinaryOpUGen *unit, int inNumSamples);
484 void eq_ak(BinaryOpUGen *unit, int inNumSamples);
485 void eq_ka(BinaryOpUGen *unit, int inNumSamples);
486 void eq_ai(BinaryOpUGen *unit, int inNumSamples);
487 void eq_ia(BinaryOpUGen *unit, int inNumSamples);
488 void neq_d(BinaryOpUGen *unit, int inNumSamples);
489 void neq_1(BinaryOpUGen *unit, int inNumSamples);
490 void neq_aa(BinaryOpUGen *unit, int inNumSamples);
491 void neq_ak(BinaryOpUGen *unit, int inNumSamples);
492 void neq_ka(BinaryOpUGen *unit, int inNumSamples);
493 void neq_ai(BinaryOpUGen *unit, int inNumSamples);
494 void neq_ia(BinaryOpUGen *unit, int inNumSamples);
495 void sumsqr_d(BinaryOpUGen *unit, int inNumSamples);
496 void sumsqr_1(BinaryOpUGen *unit, int inNumSamples);
497 void sumsqr_aa(BinaryOpUGen *unit, int inNumSamples);
498 void sumsqr_ak(BinaryOpUGen *unit, int inNumSamples);
499 void sumsqr_ka(BinaryOpUGen *unit, int inNumSamples);
500 void sumsqr_ai(BinaryOpUGen *unit, int inNumSamples);
501 void sumsqr_ia(BinaryOpUGen *unit, int inNumSamples);
502 void difsqr_d(BinaryOpUGen *unit, int inNumSamples);
503 void difsqr_1(BinaryOpUGen *unit, int inNumSamples);
504 void difsqr_aa(BinaryOpUGen *unit, int inNumSamples);
505 void difsqr_ak(BinaryOpUGen *unit, int inNumSamples);
506 void difsqr_ka(BinaryOpUGen *unit, int inNumSamples);
507 void difsqr_ai(BinaryOpUGen *unit, int inNumSamples);
508 void difsqr_ia(BinaryOpUGen *unit, int inNumSamples);
509 void sqrsum_d(BinaryOpUGen *unit, int inNumSamples);
510 void sqrsum_1(BinaryOpUGen *unit, int inNumSamples);
511 void sqrsum_aa(BinaryOpUGen *unit, int inNumSamples);
512 void sqrsum_ak(BinaryOpUGen *unit, int inNumSamples);
513 void sqrsum_ka(BinaryOpUGen *unit, int inNumSamples);
514 void sqrsum_ai(BinaryOpUGen *unit, int inNumSamples);
515 void sqrsum_ia(BinaryOpUGen *unit, int inNumSamples);
516 void sqrdif_d(BinaryOpUGen *unit, int inNumSamples);
517 void sqrdif_1(BinaryOpUGen *unit, int inNumSamples);
518 void sqrdif_aa(BinaryOpUGen *unit, int inNumSamples);
519 void sqrdif_ak(BinaryOpUGen *unit, int inNumSamples);
520 void sqrdif_ka(BinaryOpUGen *unit, int inNumSamples);
521 void sqrdif_ai(BinaryOpUGen *unit, int inNumSamples);
522 void sqrdif_ia(BinaryOpUGen *unit, int inNumSamples);
523 void absdif_d(BinaryOpUGen *unit, int inNumSamples);
524 void absdif_1(BinaryOpUGen *unit, int inNumSamples);
525 void absdif_aa(BinaryOpUGen *unit, int inNumSamples);
526 void absdif_ak(BinaryOpUGen *unit, int inNumSamples);
527 void absdif_ka(BinaryOpUGen *unit, int inNumSamples);
528 void absdif_ai(BinaryOpUGen *unit, int inNumSamples);
529 void absdif_ia(BinaryOpUGen *unit, int inNumSamples);
530 void round_d(BinaryOpUGen *unit, int inNumSamples);
531 void round_1(BinaryOpUGen *unit, int inNumSamples);
532 void round_aa(BinaryOpUGen *unit, int inNumSamples);
533 void round_ak(BinaryOpUGen *unit, int inNumSamples);
534 void round_ka(BinaryOpUGen *unit, int inNumSamples);
535 void round_ai(BinaryOpUGen *unit, int inNumSamples);
536 void round_ia(BinaryOpUGen *unit, int inNumSamples);
537 void roundUp_d(BinaryOpUGen *unit, int inNumSamples);
538 void roundUp_1(BinaryOpUGen *unit, int inNumSamples);
539 void roundUp_aa(BinaryOpUGen *unit, int inNumSamples);
540 void roundUp_ak(BinaryOpUGen *unit, int inNumSamples);
541 void roundUp_ka(BinaryOpUGen *unit, int inNumSamples);
542 void roundUp_ai(BinaryOpUGen *unit, int inNumSamples);
543 void roundUp_ia(BinaryOpUGen *unit, int inNumSamples);
544 void trunc_d(BinaryOpUGen *unit, int inNumSamples);
545 void trunc_1(BinaryOpUGen *unit, int inNumSamples);
546 void trunc_aa(BinaryOpUGen *unit, int inNumSamples);
547 void trunc_ak(BinaryOpUGen *unit, int inNumSamples);
548 void trunc_ka(BinaryOpUGen *unit, int inNumSamples);
549 void trunc_ai(BinaryOpUGen *unit, int inNumSamples);
550 void trunc_ia(BinaryOpUGen *unit, int inNumSamples);
551 void atan2_d(BinaryOpUGen *unit, int inNumSamples);
552 void atan2_1(BinaryOpUGen *unit, int inNumSamples);
553 void atan2_aa(BinaryOpUGen *unit, int inNumSamples);
554 void atan2_ak(BinaryOpUGen *unit, int inNumSamples);
555 void atan2_ka(BinaryOpUGen *unit, int inNumSamples);
556 void atan2_ai(BinaryOpUGen *unit, int inNumSamples);
557 void atan2_ia(BinaryOpUGen *unit, int inNumSamples);
558 void hypot_d(BinaryOpUGen *unit, int inNumSamples);
559 void hypot_1(BinaryOpUGen *unit, int inNumSamples);
560 void hypot_aa(BinaryOpUGen *unit, int inNumSamples);
561 void hypot_ak(BinaryOpUGen *unit, int inNumSamples);
562 void hypot_ka(BinaryOpUGen *unit, int inNumSamples);
563 void hypot_ai(BinaryOpUGen *unit, int inNumSamples);
564 void hypot_ia(BinaryOpUGen *unit, int inNumSamples);
565 void hypotx_d(BinaryOpUGen *unit, int inNumSamples);
566 void hypotx_1(BinaryOpUGen *unit, int inNumSamples);
567 void hypotx_aa(BinaryOpUGen *unit, int inNumSamples);
568 void hypotx_ak(BinaryOpUGen *unit, int inNumSamples);
569 void hypotx_ka(BinaryOpUGen *unit, int inNumSamples);
570 void hypotx_ai(BinaryOpUGen *unit, int inNumSamples);
571 void hypotx_ia(BinaryOpUGen *unit, int inNumSamples);
574 ////////////////////////////////////////////////////////////////////////////////////////////////////////
576 static bool ChooseOperatorFunc(BinaryOpUGen *unit);
578 void BinaryOpUGen_Ctor(BinaryOpUGen *unit)
580 unit->mPrevA = ZIN0(0);
581 unit->mPrevB = ZIN0(1);
582 bool initialized = ChooseOperatorFunc(unit);
583 if (unit->mCalcRate == calc_DemandRate) {
584 OUT0(0) = 0.f;
585 } else {
586 if (!initialized)
587 (unit->mCalcFunc)(unit, 1);
592 void zero_d(BinaryOpUGen *unit, int inNumSamples)
594 if (inNumSamples) {
595 float a = DEMANDINPUT_A(0, inNumSamples);
596 float b = DEMANDINPUT_A(1, inNumSamples);
597 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : 0.f;
598 } else {
599 RESETINPUT(0);
600 RESETINPUT(1);
605 void firstarg_d(BinaryOpUGen *unit, int inNumSamples)
607 if (inNumSamples) {
608 float a = DEMANDINPUT_A(0, inNumSamples);
609 float b = DEMANDINPUT_A(1, inNumSamples);
610 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : a;
611 } else {
612 RESETINPUT(0);
613 RESETINPUT(1);
617 void secondarg_d(BinaryOpUGen *unit, int inNumSamples)
619 if (inNumSamples) {
620 float a = DEMANDINPUT_A(0, inNumSamples);
621 float b = DEMANDINPUT_A(1, inNumSamples);
622 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : b;
623 } else {
624 RESETINPUT(0);
625 RESETINPUT(1);
629 void add_d(BinaryOpUGen *unit, int inNumSamples)
631 if (inNumSamples) {
632 float a = DEMANDINPUT_A(0, inNumSamples);
633 float b = DEMANDINPUT_A(1, inNumSamples);
634 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : a + b;
635 } else {
636 RESETINPUT(0);
637 RESETINPUT(1);
641 void sub_d(BinaryOpUGen *unit, int inNumSamples)
643 if (inNumSamples) {
644 float a = DEMANDINPUT_A(0, inNumSamples);
645 float b = DEMANDINPUT_A(1, inNumSamples);
646 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : a - b;
647 } else {
648 RESETINPUT(0);
649 RESETINPUT(1);
653 void mul_d(BinaryOpUGen *unit, int inNumSamples)
655 if (inNumSamples) {
656 float a = DEMANDINPUT_A(0, inNumSamples);
657 float b = DEMANDINPUT_A(1, inNumSamples);
658 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : a * b;
659 } else {
660 RESETINPUT(0);
661 RESETINPUT(1);
665 void div_d(BinaryOpUGen *unit, int inNumSamples)
667 if (inNumSamples) {
668 float a = DEMANDINPUT_A(0, inNumSamples);
669 float b = DEMANDINPUT_A(1, inNumSamples);
670 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : a / b;
671 } else {
672 RESETINPUT(0);
673 RESETINPUT(1);
677 void mod_d(BinaryOpUGen *unit, int inNumSamples)
679 if (inNumSamples) {
680 float a = DEMANDINPUT_A(0, inNumSamples);
681 float b = DEMANDINPUT_A(1, inNumSamples);
682 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : sc_mod(a, b);
683 } else {
684 RESETINPUT(0);
685 RESETINPUT(1);
689 void max_d(BinaryOpUGen *unit, int inNumSamples)
691 if (inNumSamples) {
692 float a = DEMANDINPUT_A(0, inNumSamples);
693 float b = DEMANDINPUT_A(1, inNumSamples);
694 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : sc_max(a, b);
695 } else {
696 RESETINPUT(0);
697 RESETINPUT(1);
701 void min_d(BinaryOpUGen *unit, int inNumSamples)
703 if (inNumSamples) {
704 float a = DEMANDINPUT_A(0, inNumSamples);
705 float b = DEMANDINPUT_A(1, inNumSamples);
706 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : sc_min(a, b);
707 } else {
708 RESETINPUT(0);
709 RESETINPUT(1);
713 void and_d(BinaryOpUGen *unit, int inNumSamples)
715 if (inNumSamples) {
716 float a = DEMANDINPUT_A(0, inNumSamples);
717 float b = DEMANDINPUT_A(1, inNumSamples);
718 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : sc_andt(a, b);
719 } else {
720 RESETINPUT(0);
721 RESETINPUT(1);
725 void or_d(BinaryOpUGen *unit, int inNumSamples)
727 if (inNumSamples) {
728 float a = DEMANDINPUT_A(0, inNumSamples);
729 float b = DEMANDINPUT_A(1, inNumSamples);
730 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : sc_ort(a, b);
731 } else {
732 RESETINPUT(0);
733 RESETINPUT(1);
737 void xor_d(BinaryOpUGen *unit, int inNumSamples)
739 if (inNumSamples) {
740 float a = DEMANDINPUT_A(0, inNumSamples);
741 float b = DEMANDINPUT_A(1, inNumSamples);
742 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : sc_xort(a, b);
743 } else {
744 RESETINPUT(0);
745 RESETINPUT(1);
749 void rightShift_d(BinaryOpUGen *unit, int inNumSamples)
751 if (inNumSamples) {
752 float a = DEMANDINPUT_A(0, inNumSamples);
753 float b = DEMANDINPUT_A(1, inNumSamples);
754 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : sc_rst(a, b);
755 } else {
756 RESETINPUT(0);
757 RESETINPUT(1);
761 void leftShift_d(BinaryOpUGen *unit, int inNumSamples)
763 if (inNumSamples) {
764 float a = DEMANDINPUT_A(0, inNumSamples);
765 float b = DEMANDINPUT_A(1, inNumSamples);
766 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : sc_lst(a, b);
767 } else {
768 RESETINPUT(0);
769 RESETINPUT(1);
773 void amclip_d(BinaryOpUGen *unit, int inNumSamples)
775 if (inNumSamples) {
776 float a = DEMANDINPUT_A(0, inNumSamples);
777 float b = DEMANDINPUT_A(1, inNumSamples);
778 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : sc_amclip(a, b);
779 } else {
780 RESETINPUT(0);
781 RESETINPUT(1);
785 void scaleneg_d(BinaryOpUGen *unit, int inNumSamples)
787 if (inNumSamples) {
788 float a = DEMANDINPUT_A(0, inNumSamples);
789 float b = DEMANDINPUT_A(1, inNumSamples);
790 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : sc_scaleneg(a, b);
791 } else {
792 RESETINPUT(0);
793 RESETINPUT(1);
797 void pow_d(BinaryOpUGen *unit, int inNumSamples)
799 if (inNumSamples) {
800 float a = DEMANDINPUT_A(0, inNumSamples);
801 float b = DEMANDINPUT_A(1, inNumSamples);
802 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : (a < 0.f ? -pow(-a, b) : pow(a, b));
803 } else {
804 RESETINPUT(0);
805 RESETINPUT(1);
809 void ring1_d(BinaryOpUGen *unit, int inNumSamples)
811 if (inNumSamples) {
812 float a = DEMANDINPUT_A(0, inNumSamples);
813 float b = DEMANDINPUT_A(1, inNumSamples);
814 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : a * b + a;
815 } else {
816 RESETINPUT(0);
817 RESETINPUT(1);
821 void ring2_d(BinaryOpUGen *unit, int inNumSamples)
823 if (inNumSamples) {
824 float a = DEMANDINPUT_A(0, inNumSamples);
825 float b = DEMANDINPUT_A(1, inNumSamples);
826 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : a * b + a + b;
827 } else {
828 RESETINPUT(0);
829 RESETINPUT(1);
833 void ring3_d(BinaryOpUGen *unit, int inNumSamples)
835 if (inNumSamples) {
836 float a = DEMANDINPUT_A(0, inNumSamples);
837 float b = DEMANDINPUT_A(1, inNumSamples);
838 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : a * a * b;
839 } else {
840 RESETINPUT(0);
841 RESETINPUT(1);
845 void ring4_d(BinaryOpUGen *unit, int inNumSamples)
847 if (inNumSamples) {
848 float a = DEMANDINPUT_A(0, inNumSamples);
849 float b = DEMANDINPUT_A(1, inNumSamples);
850 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : a * a * b - a * b * b;
851 } else {
852 RESETINPUT(0);
853 RESETINPUT(1);
857 void thresh_d(BinaryOpUGen *unit, int inNumSamples)
859 if (inNumSamples) {
860 float a = DEMANDINPUT_A(0, inNumSamples);
861 float b = DEMANDINPUT_A(1, inNumSamples);
862 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : sc_thresh(a, b);
863 } else {
864 RESETINPUT(0);
865 RESETINPUT(1);
869 void clip2_d(BinaryOpUGen *unit, int inNumSamples)
871 if (inNumSamples) {
872 float a = DEMANDINPUT_A(0, inNumSamples);
873 float b = DEMANDINPUT_A(1, inNumSamples);
874 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : sc_clip2(a, b);
875 } else {
876 RESETINPUT(0);
877 RESETINPUT(1);
881 void excess_d(BinaryOpUGen *unit, int inNumSamples)
883 if (inNumSamples) {
884 float a = DEMANDINPUT_A(0, inNumSamples);
885 float b = DEMANDINPUT_A(1, inNumSamples);
886 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : sc_excess(a, b);
887 } else {
888 RESETINPUT(0);
889 RESETINPUT(1);
893 void lt_d(BinaryOpUGen *unit, int inNumSamples)
895 if (inNumSamples) {
896 float a = DEMANDINPUT_A(0, inNumSamples);
897 float b = DEMANDINPUT_A(1, inNumSamples);
898 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : (a < b ? 1.f : 0.f);
899 } else {
900 RESETINPUT(0);
901 RESETINPUT(1);
905 void gt_d(BinaryOpUGen *unit, int inNumSamples)
907 if (inNumSamples) {
908 float a = DEMANDINPUT_A(0, inNumSamples);
909 float b = DEMANDINPUT_A(1, inNumSamples);
910 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : (a > b ? 1.f : 0.f);
911 } else {
912 RESETINPUT(0);
913 RESETINPUT(1);
917 void le_d(BinaryOpUGen *unit, int inNumSamples)
919 if (inNumSamples) {
920 float a = DEMANDINPUT_A(0, inNumSamples);
921 float b = DEMANDINPUT_A(1, inNumSamples);
922 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : (a <= b ? 1.f : 0.f);
923 } else {
924 RESETINPUT(0);
925 RESETINPUT(1);
929 void ge_d(BinaryOpUGen *unit, int inNumSamples)
931 if (inNumSamples) {
932 float a = DEMANDINPUT_A(0, inNumSamples);
933 float b = DEMANDINPUT_A(1, inNumSamples);
934 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : (a >= b ? 1.f : 0.f);
935 } else {
936 RESETINPUT(0);
937 RESETINPUT(1);
941 void eq_d(BinaryOpUGen *unit, int inNumSamples)
943 if (inNumSamples) {
944 float a = DEMANDINPUT_A(0, inNumSamples);
945 float b = DEMANDINPUT_A(1, inNumSamples);
946 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : (a == b ? 1.f : 0.f);
947 } else {
948 RESETINPUT(0);
949 RESETINPUT(1);
953 void neq_d(BinaryOpUGen *unit, int inNumSamples)
955 if (inNumSamples) {
956 float a = DEMANDINPUT_A(0, inNumSamples);
957 float b = DEMANDINPUT_A(1, inNumSamples);
958 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : (a != b ? 1.f : 0.f);
959 } else {
960 RESETINPUT(0);
961 RESETINPUT(1);
965 void sumsqr_d(BinaryOpUGen *unit, int inNumSamples)
967 if (inNumSamples) {
968 float a = DEMANDINPUT_A(0, inNumSamples);
969 float b = DEMANDINPUT_A(1, inNumSamples);
970 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : a * a + b * b;
971 } else {
972 RESETINPUT(0);
973 RESETINPUT(1);
977 void difsqr_d(BinaryOpUGen *unit, int inNumSamples)
979 if (inNumSamples) {
980 float a = DEMANDINPUT_A(0, inNumSamples);
981 float b = DEMANDINPUT_A(1, inNumSamples);
982 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : a * a - b * b;
983 } else {
984 RESETINPUT(0);
985 RESETINPUT(1);
989 void sqrsum_d(BinaryOpUGen *unit, int inNumSamples)
991 if (inNumSamples) {
992 float a = DEMANDINPUT_A(0, inNumSamples);
993 float b = DEMANDINPUT_A(1, inNumSamples);
994 float z;
995 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : (z = a + b, z * z);
996 } else {
997 RESETINPUT(0);
998 RESETINPUT(1);
1002 void sqrdif_d(BinaryOpUGen *unit, int inNumSamples)
1004 if (inNumSamples) {
1005 float a = DEMANDINPUT_A(0, inNumSamples);
1006 float b = DEMANDINPUT_A(1, inNumSamples);
1007 float z;
1008 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : (z = a - b, z * z);
1009 } else {
1010 RESETINPUT(0);
1011 RESETINPUT(1);
1015 void absdif_d(BinaryOpUGen *unit, int inNumSamples)
1017 if (inNumSamples) {
1018 float a = DEMANDINPUT_A(0, inNumSamples);
1019 float b = DEMANDINPUT_A(1, inNumSamples);
1020 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : fabs(a - b);
1021 } else {
1022 RESETINPUT(0);
1023 RESETINPUT(1);
1027 void round_d(BinaryOpUGen *unit, int inNumSamples)
1029 if (inNumSamples) {
1030 float a = DEMANDINPUT_A(0, inNumSamples);
1031 float b = DEMANDINPUT_A(1, inNumSamples);
1032 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : sc_round(a, b);
1033 } else {
1034 RESETINPUT(0);
1035 RESETINPUT(1);
1039 void roundUp_d(BinaryOpUGen *unit, int inNumSamples)
1041 if (inNumSamples) {
1042 float a = DEMANDINPUT_A(0, inNumSamples);
1043 float b = DEMANDINPUT_A(1, inNumSamples);
1044 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : sc_roundUp(a, b);
1045 } else {
1046 RESETINPUT(0);
1047 RESETINPUT(1);
1051 void trunc_d(BinaryOpUGen *unit, int inNumSamples)
1053 if (inNumSamples) {
1054 float a = DEMANDINPUT_A(0, inNumSamples);
1055 float b = DEMANDINPUT_A(1, inNumSamples);
1056 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : sc_trunc(a, b);
1057 } else {
1058 RESETINPUT(0);
1059 RESETINPUT(1);
1063 void fold2_d(BinaryOpUGen *unit, int inNumSamples)
1065 if (inNumSamples) {
1066 float a = DEMANDINPUT_A(0, inNumSamples);
1067 float b = DEMANDINPUT_A(1, inNumSamples);
1068 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : sc_fold2(a, b);
1069 } else {
1070 RESETINPUT(0);
1071 RESETINPUT(1);
1075 void wrap2_d(BinaryOpUGen *unit, int inNumSamples)
1077 if (inNumSamples) {
1078 float a = DEMANDINPUT_A(0, inNumSamples);
1079 float b = DEMANDINPUT_A(1, inNumSamples);
1080 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : sc_wrap2(a, b);
1081 } else {
1082 RESETINPUT(0);
1083 RESETINPUT(1);
1087 void atan2_d(BinaryOpUGen *unit, int inNumSamples)
1089 if (inNumSamples) {
1090 float a = DEMANDINPUT_A(0, inNumSamples);
1091 float b = DEMANDINPUT_A(1, inNumSamples);
1092 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : atan2(a, b);
1093 } else {
1094 RESETINPUT(0);
1095 RESETINPUT(1);
1099 void hypot_d(BinaryOpUGen *unit, int inNumSamples)
1101 if (inNumSamples) {
1102 float a = DEMANDINPUT_A(0, inNumSamples);
1103 float b = DEMANDINPUT_A(1, inNumSamples);
1104 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : hypot(a, b);
1105 } else {
1106 RESETINPUT(0);
1107 RESETINPUT(1);
1111 void hypotx_d(BinaryOpUGen *unit, int inNumSamples)
1113 if (inNumSamples) {
1114 float a = DEMANDINPUT_A(0, inNumSamples);
1115 float b = DEMANDINPUT_A(1, inNumSamples);
1116 OUT0(0) = sc_isnan(a) || sc_isnan(b) ? NAN : sc_hypotx(a, b);
1117 } else {
1118 RESETINPUT(0);
1119 RESETINPUT(1);
1125 void zero_1(BinaryOpUGen *unit, int inNumSamples)
1127 ZOUT0(0) = 0.f;
1130 void firstarg_1(BinaryOpUGen *unit, int inNumSamples)
1132 ZOUT0(0) = ZIN0(0);
1135 void secondarg_1(BinaryOpUGen *unit, int inNumSamples)
1137 ZOUT0(0) = ZIN0(1);
1140 void add_1(BinaryOpUGen *unit, int inNumSamples)
1142 ZOUT0(0) = ZIN0(0) + ZIN0(1);
1145 void sub_1(BinaryOpUGen *unit, int inNumSamples)
1147 ZOUT0(0) = ZIN0(0) - ZIN0(1);
1150 void mul_1(BinaryOpUGen *unit, int inNumSamples)
1152 ZOUT0(0) = ZIN0(0) * ZIN0(1);
1155 void div_1(BinaryOpUGen *unit, int inNumSamples)
1157 ZOUT0(0) = ZIN0(0) / ZIN0(1);
1160 void mod_1(BinaryOpUGen *unit, int inNumSamples)
1162 float xa = ZIN0(0);
1163 float xb = ZIN0(1);
1164 ZOUT0(0) = sc_mod(xa, xb);
1167 void max_1(BinaryOpUGen *unit, int inNumSamples)
1169 float xa = ZIN0(0);
1170 float xb = ZIN0(1);
1171 ZOUT0(0) = sc_max(xa, xb);
1174 void min_1(BinaryOpUGen *unit, int inNumSamples)
1176 float xa = ZIN0(0);
1177 float xb = ZIN0(1);
1178 ZOUT0(0) = sc_min(xa, xb);
1181 void and_1(BinaryOpUGen *unit, int inNumSamples)
1183 float xa = ZIN0(0);
1184 float xb = ZIN0(1);
1185 ZOUT0(0) = sc_andt(xa, xb);
1188 void or_1(BinaryOpUGen *unit, int inNumSamples)
1190 float xa = ZIN0(0);
1191 float xb = ZIN0(1);
1192 ZOUT0(0) = sc_ort(xa, xb);
1195 void xor_1(BinaryOpUGen *unit, int inNumSamples)
1197 float xa = ZIN0(0);
1198 float xb = ZIN0(1);
1199 ZOUT0(0) = sc_xort(xa, xb);
1202 void rightShift_1(BinaryOpUGen *unit, int inNumSamples)
1204 float xa = ZIN0(0);
1205 float xb = ZIN0(1);
1206 ZOUT0(0) = sc_rst(xa, xb);
1209 void leftShift_1(BinaryOpUGen *unit, int inNumSamples)
1211 float xa = ZIN0(0);
1212 float xb = ZIN0(1);
1213 ZOUT0(0) = sc_lst(xa, xb);
1216 void amclip_1(BinaryOpUGen *unit, int inNumSamples)
1218 float xa = ZIN0(0);
1219 float xb = ZIN0(1);
1220 ZOUT0(0) = sc_amclip(xa, xb);
1223 void scaleneg_1(BinaryOpUGen *unit, int inNumSamples)
1225 float xa = ZIN0(0);
1226 float xb = ZIN0(1);
1227 ZOUT0(0) = xa >= 0.f ? xa : xa * xb;
1230 void pow_1(BinaryOpUGen *unit, int inNumSamples)
1232 float xa = ZIN0(0);
1233 float xb = ZIN0(1);
1234 ZOUT0(0) = xa >= 0.f ? pow(xa, xb) : -pow(-xa, xb);
1238 void ring1_1(BinaryOpUGen *unit, int inNumSamples)
1240 float xa = ZIN0(0);
1241 float xb = ZIN0(1);
1242 ZOUT0(0) = xa * xb + xa;
1245 void ring2_1(BinaryOpUGen *unit, int inNumSamples)
1247 float xa = ZIN0(0);
1248 float xb = ZIN0(1);
1249 ZOUT0(0) = xa * xb + xa + xb;
1252 void ring3_1(BinaryOpUGen *unit, int inNumSamples)
1254 float xa = ZIN0(0);
1255 float xb = ZIN0(1);
1256 ZOUT0(0) = xa * xa * xb;
1259 void ring4_1(BinaryOpUGen *unit, int inNumSamples)
1261 float xa = ZIN0(0);
1262 float xb = ZIN0(1);
1263 ZOUT0(0) = xa * xa * xb - xa * xb * xb;
1266 void thresh_1(BinaryOpUGen *unit, int inNumSamples)
1268 float xa = ZIN0(0);
1269 float xb = ZIN0(1);
1270 ZOUT0(0) = xa < xb ? 0.f : xa;
1273 void clip2_1(BinaryOpUGen *unit, int inNumSamples)
1275 float xa = ZIN0(0);
1276 float xb = ZIN0(1);
1277 ZOUT0(0) = xa > xb ? xb : (xa < -xb ? -xb : xa);
1280 void excess_1(BinaryOpUGen *unit, int inNumSamples)
1282 float xa = ZIN0(0);
1283 float xb = ZIN0(1);
1284 ZOUT0(0) = xa > xb ? xa-xb : (xa < -xb ? xa+xb : 0.f);
1287 void lt_1(BinaryOpUGen *unit, int inNumSamples)
1289 float xa = ZIN0(0);
1290 float xb = ZIN0(1);
1291 ZOUT0(0) = xa < xb ? 1.f : 0.f;
1294 void le_1(BinaryOpUGen *unit, int inNumSamples)
1296 float xa = ZIN0(0);
1297 float xb = ZIN0(1);
1298 ZOUT0(0) = xa <= xb ? 1.f : 0.f;
1301 void gt_1(BinaryOpUGen *unit, int inNumSamples)
1303 float xa = ZIN0(0);
1304 float xb = ZIN0(1);
1305 ZOUT0(0) = xa > xb ? 1.f : 0.f;
1308 void ge_1(BinaryOpUGen *unit, int inNumSamples)
1310 float xa = ZIN0(0);
1311 float xb = ZIN0(1);
1312 ZOUT0(0) = xa >= xb ? 1.f : 0.f;
1315 void eq_1(BinaryOpUGen *unit, int inNumSamples)
1317 float xa = ZIN0(0);
1318 float xb = ZIN0(1);
1319 ZOUT0(0) = xa == xb ? 1.f : 0.f;
1322 void neq_1(BinaryOpUGen *unit, int inNumSamples)
1324 float xa = ZIN0(0);
1325 float xb = ZIN0(1);
1326 ZOUT0(0) = xa != xb ? 1.f : 0.f;
1330 void sumsqr_1(BinaryOpUGen *unit, int inNumSamples)
1332 float xa = ZIN0(0);
1333 float xb = ZIN0(1);
1334 ZOUT0(0) = xa * xa + xb * xb;
1337 void difsqr_1(BinaryOpUGen *unit, int inNumSamples)
1339 float xa = ZIN0(0);
1340 float xb = ZIN0(1);
1341 ZOUT0(0) = xa * xa - xb * xb;
1344 void sqrsum_1(BinaryOpUGen *unit, int inNumSamples)
1346 float xa = ZIN0(0);
1347 float xb = ZIN0(1);
1348 float sum = xa + xb;
1349 ZOUT0(0) = sum * sum;
1352 void sqrdif_1(BinaryOpUGen *unit, int inNumSamples)
1354 float xa = ZIN0(0);
1355 float xb = ZIN0(1);
1356 float dif = xa - xb;
1357 ZOUT0(0) = dif * dif;
1360 void absdif_1(BinaryOpUGen *unit, int inNumSamples)
1362 float xa = ZIN0(0);
1363 float xb = ZIN0(1);
1364 ZOUT0(0) = fabs(xa - xb);
1367 void round_1(BinaryOpUGen *unit, int inNumSamples)
1369 float xa = ZIN0(0);
1370 float xb = ZIN0(1);
1371 ZOUT0(0) = sc_round(xa, xb);
1374 void roundUp_1(BinaryOpUGen *unit, int inNumSamples)
1376 float xa = ZIN0(0);
1377 float xb = ZIN0(1);
1378 ZOUT0(0) = sc_roundUp(xa, xb);
1381 void trunc_1(BinaryOpUGen *unit, int inNumSamples)
1383 float xa = ZIN0(0);
1384 float xb = ZIN0(1);
1385 ZOUT0(0) = sc_trunc(xa, xb);
1388 void fold2_1(BinaryOpUGen *unit, int inNumSamples)
1390 float xa = ZIN0(0);
1391 float xb = ZIN0(1);
1392 ZOUT0(0) = sc_fold(xa, -xb, xb);
1395 void wrap2_1(BinaryOpUGen *unit, int inNumSamples)
1397 float xa = ZIN0(0);
1398 float xb = ZIN0(1);
1399 ZOUT0(0) = sc_wrap(xa, -xb, xb);
1402 void atan2_1(BinaryOpUGen *unit, int inNumSamples)
1404 float xa = ZIN0(0);
1405 float xb = ZIN0(1);
1406 ZOUT0(0) = atan2(xa, xb);
1409 void hypot_1(BinaryOpUGen *unit, int inNumSamples)
1411 float xa = ZIN0(0);
1412 float xb = ZIN0(1);
1413 ZOUT0(0) = hypot(xa, xb);
1416 void hypotx_1(BinaryOpUGen *unit, int inNumSamples)
1418 float xa = ZIN0(0);
1419 float xb = ZIN0(1);
1420 ZOUT0(0) = sc_hypotx(xa, xb);
1425 void zero_aa(BinaryOpUGen *unit, int inNumSamples)
1427 float *out = ZOUT(0);
1429 ZClear(inNumSamples, out);
1432 void firstarg_aa(BinaryOpUGen *unit, int inNumSamples)
1434 float *out = ZOUT(0);
1435 float *a = ZIN(0);
1437 ZCopy(inNumSamples, out, a);
1440 #ifdef NOVA_SIMD
1441 FLATTEN void firstarg_aa_nova(BinaryOpUGen *unit, int inNumSamples)
1443 nova::copyvec_simd(OUT(0), IN(0), inNumSamples);
1445 #endif
1447 void secondarg_aa(BinaryOpUGen *unit, int inNumSamples)
1449 float *out = ZOUT(0);
1450 float *b = ZIN(1);
1452 ZCopy(inNumSamples, out, b);
1455 #ifdef NOVA_SIMD
1456 FLATTEN void secondarg_aa_nova(BinaryOpUGen *unit, int inNumSamples)
1458 nova::copyvec_simd(OUT(0), IN(1), inNumSamples);
1460 #endif
1462 void add_aa(BinaryOpUGen *unit, int inNumSamples)
1464 float *out = ZOUT(0);
1465 float *a = ZIN(0);
1466 float *b = ZIN(1);
1468 LOOP1(inNumSamples,
1469 ZXP(out) = ZXP(a) + ZXP(b);
1473 void add_ak(BinaryOpUGen *unit, int inNumSamples)
1475 float *out = ZOUT(0);
1476 float *a = ZIN(0);
1477 float xb = unit->mPrevB;
1478 float next_b = ZIN0(1);
1480 if (xb == next_b) {
1481 if (xb == 0.f) {
1482 ZCopy(inNumSamples, out, a);
1483 } else {
1484 float *out = ZOUT(0);
1485 float *a = ZIN(0);
1486 LOOP1(inNumSamples,
1487 ZXP(out) = ZXP(a) + xb;
1490 } else {
1491 float slope = CALCSLOPE(next_b, xb);
1492 LOOP1(inNumSamples,
1493 ZXP(out) = ZXP(a) + xb;
1494 xb += slope;
1496 unit->mPrevB = xb;
1501 void add_ka(BinaryOpUGen *unit, int inNumSamples)
1503 float *out = ZOUT(0);
1504 float xa = unit->mPrevA;
1505 float *b = ZIN(1);
1506 float next_a = ZIN0(0);
1508 if (xa == next_a) {
1509 if (xa == 0.f) {
1510 ZCopy(inNumSamples, out, b);
1511 } else {
1512 LOOP1(inNumSamples,
1513 ZXP(out) = xa + ZXP(b);
1516 } else {
1517 float slope = CALCSLOPE(next_a, xa);
1518 LOOP1(inNumSamples,
1519 ZXP(out) = xa + ZXP(b);
1520 xa += slope;
1522 unit->mPrevA = xa;
1526 void add_ia(BinaryOpUGen *unit, int inNumSamples)
1528 float *out = ZOUT(0);
1529 float xa = ZIN0(0);
1530 float *b = ZIN(1);
1532 LOOP1(inNumSamples,
1533 ZXP(out) = xa + ZXP(b);
1535 unit->mPrevA = xa;
1538 void add_ai(BinaryOpUGen *unit, int inNumSamples)
1540 float *out = ZOUT(0);
1541 float *a = ZIN(0);
1542 float xb = ZIN0(1);
1544 LOOP1(inNumSamples,
1545 ZXP(out) = ZXP(a) + xb;
1547 unit->mPrevB = xb;
1550 #ifdef NOVA_SIMD
1551 NOVA_BINARY_WRAPPER(add, plus)
1553 FLATTEN void add_ak_nova(BinaryOpUGen *unit, int inNumSamples)
1555 float xb = unit->mPrevB;
1556 float next_b = ZIN0(1);
1558 if (xb == next_b) {
1559 if (xb == 0.f)
1560 nova::copyvec_simd(OUT(0), IN(0), inNumSamples);
1561 else
1562 nova::plus_vec_simd(OUT(0), IN(0), xb, inNumSamples);
1563 } else {
1564 float slope = CALCSLOPE(next_b, xb);
1565 nova::plus_vec_simd(OUT(0), IN(0), slope_argument(xb, slope), inNumSamples);
1566 unit->mPrevB = next_b;
1570 FLATTEN void add_ak_nova_64(BinaryOpUGen *unit, int inNumSamples)
1572 float xb = unit->mPrevB;
1573 float next_b = ZIN0(1);
1575 if (xb == next_b) {
1576 if (xb == 0.f)
1577 nova::copyvec_simd<64>(OUT(0), IN(0));
1578 else
1579 nova::plus_vec_simd<64>(OUT(0), IN(0), xb);
1580 } else {
1581 float slope = CALCSLOPE(next_b, xb);
1582 nova::plus_vec_simd(OUT(0), IN(0), slope_argument(xb, slope), inNumSamples);
1583 unit->mPrevB = next_b;
1588 FLATTEN void add_ka_nova(BinaryOpUGen *unit, int inNumSamples)
1590 float xa = unit->mPrevA;
1591 float next_a = ZIN0(0);
1593 if (xa == next_a) {
1594 if (xa == 0.f)
1595 nova::copyvec_simd(OUT(0), IN(1), inNumSamples);
1596 else
1597 nova::plus_vec_simd(OUT(0), IN(1), xa, inNumSamples);
1598 } else {
1599 float slope = CALCSLOPE(next_a, xa);
1600 nova::plus_vec_simd(OUT(0), IN(1), slope_argument(xa, slope), inNumSamples);
1601 unit->mPrevA = next_a;
1605 FLATTEN void add_ka_nova_64(BinaryOpUGen *unit, int inNumSamples)
1607 float xa = unit->mPrevA;
1608 float next_a = ZIN0(0);
1610 if (xa == next_a) {
1611 if (xa == 0.f)
1612 nova::copyvec_simd<64>(OUT(0), IN(1));
1613 else
1614 nova::plus_vec_simd<64>(OUT(0), IN(1), xa);
1615 } else {
1616 float slope = CALCSLOPE(next_a, xa);
1617 nova::plus_vec_simd(OUT(0), IN(1), slope_argument(xa, slope), inNumSamples);
1618 unit->mPrevA = next_a;
1622 #endif
1626 /////////////////////////
1630 void sub_aa(BinaryOpUGen *unit, int inNumSamples)
1632 float *out = ZOUT(0);
1633 float *a = ZIN(0);
1634 float *b = ZIN(1);
1636 LOOP1(inNumSamples,
1637 ZXP(out) = ZXP(a) - ZXP(b);
1641 void sub_ak(BinaryOpUGen *unit, int inNumSamples)
1643 float *out = ZOUT(0);
1644 float *a = ZIN(0);
1645 float xb = unit->mPrevB;
1646 float next_b = ZIN0(1);
1648 if (xb == next_b) {
1649 if (xb == 0.f) {
1650 ZCopy(inNumSamples, out, a);
1651 } else {
1652 LOOP1(inNumSamples,
1653 ZXP(out) = ZXP(a) - xb;
1656 } else {
1657 float slope = CALCSLOPE(next_b, xb);
1658 LOOP1(inNumSamples,
1659 ZXP(out) = ZXP(a) - xb;
1660 xb += slope;
1662 unit->mPrevB = xb;
1666 void sub_ka(BinaryOpUGen *unit, int inNumSamples)
1668 float *out = ZOUT(0);
1669 float xa = unit->mPrevA;
1670 float *b = ZIN(1);
1671 float next_a = ZIN0(0);
1673 if (xa == next_a) {
1674 if (xa == 0.f) {
1675 ZCopy(inNumSamples, out, b);
1676 } else {
1677 LOOP1(inNumSamples,
1678 ZXP(out) = xa - ZXP(b);
1681 } else {
1682 float slope = CALCSLOPE(next_a, xa);
1683 LOOP1(inNumSamples,
1684 ZXP(out) = xa - ZXP(b);
1685 xa += slope;
1687 unit->mPrevA = xa;
1692 void sub_ia(BinaryOpUGen *unit, int inNumSamples)
1694 float *out = ZOUT(0);
1695 float xa = ZIN0(0);
1696 float *b = ZIN(1);
1698 LOOP1(inNumSamples,
1699 ZXP(out) = xa - ZXP(b);
1701 unit->mPrevA = xa;
1704 void sub_ai(BinaryOpUGen *unit, int inNumSamples)
1706 float *out = ZOUT(0);
1707 float *a = ZIN(0);
1708 float xb = ZIN0(1);
1710 LOOP1(inNumSamples,
1711 ZXP(out) = ZXP(a) - xb;
1713 unit->mPrevB = xb;
1716 #ifdef NOVA_SIMD
1717 NOVA_BINARY_WRAPPER(sub, minus)
1719 FLATTEN void sub_ak_nova(BinaryOpUGen *unit, int inNumSamples)
1721 float xb = unit->mPrevB;
1722 float next_b = ZIN0(1);
1724 if (xb == next_b) {
1725 if (xb == 0.f)
1726 nova::copyvec_simd(OUT(0), IN(0), inNumSamples);
1727 else
1728 nova::minus_vec_simd(OUT(0), IN(0), xb, inNumSamples);
1729 } else {
1730 float slope = CALCSLOPE(next_b, xb);
1731 nova::minus_vec_simd(OUT(0), IN(0), slope_argument(xb, slope), inNumSamples);
1732 unit->mPrevB = next_b;
1736 FLATTEN void sub_ak_nova_64(BinaryOpUGen *unit, int inNumSamples)
1738 float xb = unit->mPrevB;
1739 float next_b = ZIN0(1);
1741 if (xb == next_b) {
1742 if (xb == 0.f)
1743 nova::copyvec_aa_simd<64>(OUT(0), IN(0));
1744 else
1745 nova::minus_vec_simd<64>(OUT(0), IN(0), xb);
1746 } else {
1747 float slope = CALCSLOPE(next_b, xb);
1748 nova::minus_vec_simd(OUT(0), IN(0), slope_argument(xb, slope), inNumSamples);
1749 unit->mPrevB = next_b;
1753 FLATTEN void sub_ka_nova(BinaryOpUGen *unit, int inNumSamples)
1755 float xa = unit->mPrevA;
1756 float next_a = ZIN0(0);
1758 if (xa == next_a) {
1759 if (xa == 0.f)
1760 nova::copyvec_simd(OUT(0), IN(1), inNumSamples);
1761 else
1762 nova::minus_vec_simd(OUT(0), xa, IN(1), inNumSamples);
1763 } else {
1764 float slope = CALCSLOPE(next_a, xa);
1765 nova::minus_vec_simd(OUT(0), slope_argument(xa, slope), IN(1), inNumSamples);
1766 unit->mPrevA = next_a;
1770 FLATTEN void sub_ka_nova_64(BinaryOpUGen *unit, int inNumSamples)
1772 float xa = unit->mPrevA;
1773 float next_a = ZIN0(0);
1775 if (xa == next_a) {
1776 if (xa == 0.f)
1777 nova::copyvec_simd<64>(OUT(0), IN(1));
1778 else
1779 nova::minus_vec_simd<64>(OUT(0), xa, IN(1));
1780 } else {
1781 float slope = CALCSLOPE(next_a, xa);
1782 nova::minus_vec_simd(OUT(0), slope_argument(xa, slope), IN(1), inNumSamples);
1783 unit->mPrevA = next_a;
1787 #endif
1791 void mul_aa(BinaryOpUGen *unit, int inNumSamples)
1793 float *out = ZOUT(0);
1794 float *a = ZIN(0);
1795 float *b = ZIN(1);
1797 LOOP1(inNumSamples,
1798 ZXP(out) = ZXP(a) * ZXP(b);
1802 void mul_ak(BinaryOpUGen *unit, int inNumSamples)
1804 float *out = ZOUT(0);
1805 float *a = ZIN(0);
1806 float xb = unit->mPrevB;
1807 float next_b = ZIN0(1);
1809 if (xb == next_b) {
1810 if (xb == 0.f) {
1811 ZClear(inNumSamples, out);
1812 } else if (xb == 1.f) {
1813 ZCopy(inNumSamples, out, a);
1814 } else {
1815 LOOP1(inNumSamples,
1816 ZXP(out) = ZXP(a) * xb;
1819 } else {
1820 float slope = CALCSLOPE(next_b, xb);
1821 LOOP1(inNumSamples,
1822 ZXP(out) = ZXP(a) * xb;
1823 xb += slope;
1825 unit->mPrevB = xb;
1829 void mul_ka(BinaryOpUGen *unit, int inNumSamples)
1831 float *out = ZOUT(0);
1832 float xa = unit->mPrevA;
1833 float *b = ZIN(1);
1834 float next_a = ZIN0(0);
1836 if (xa == next_a) {
1837 if (xa == 0.f) {
1838 ZClear(inNumSamples, out);
1839 } else if (xa == 1.f) {
1840 ZCopy(inNumSamples, out, b);
1841 } else {
1842 LOOP1(inNumSamples,
1843 ZXP(out) = xa * ZXP(b);
1846 } else {
1847 float slope = CALCSLOPE(next_a, xa);
1848 LOOP1(inNumSamples,
1849 ZXP(out) = xa * ZXP(b);
1850 xa += slope;
1852 unit->mPrevA = xa;
1857 void mul_ai(BinaryOpUGen *unit, int inNumSamples)
1859 float *out = ZOUT(0);
1860 float *a = ZIN(0);
1861 float xb = ZIN0(1);
1863 LOOP1(inNumSamples,
1864 ZXP(out) = ZXP(a) * xb;
1866 unit->mPrevB = xb;
1869 void mul_ia(BinaryOpUGen *unit, int inNumSamples)
1871 float *out = ZOUT(0);
1872 float xa = ZIN0(0);
1873 float *b = ZIN(1);
1875 LOOP1(inNumSamples,
1876 ZXP(out) = xa * ZXP(b);
1878 unit->mPrevA = xa;
1881 #ifdef NOVA_SIMD
1882 NOVA_BINARY_WRAPPER(mul, times)
1884 FLATTEN void mul_ka_nova(BinaryOpUGen *unit, int inNumSamples)
1886 float xa = unit->mPrevA;
1887 float next_a = ZIN0(0);
1889 if (xa == next_a) {
1890 if (xa == 0.f)
1891 nova::zerovec_simd(OUT(0), inNumSamples);
1892 else if (xa == 1.f)
1893 nova::copyvec_simd(OUT(0), IN(1), inNumSamples);
1894 else
1895 nova::times_vec_simd(OUT(0), IN(1), xa, inNumSamples);
1896 } else {
1897 float slope = CALCSLOPE(next_a, xa);
1898 unit->mPrevA = next_a;
1900 nova::times_vec_simd(OUT(0), IN(1), slope_argument(xa, slope), inNumSamples);
1904 FLATTEN void mul_ka_nova_64(BinaryOpUGen *unit, int inNumSamples)
1906 float xa = unit->mPrevA;
1907 float next_a = ZIN0(0);
1909 if (xa == next_a) {
1910 if (xa == 0.f)
1911 nova::zerovec_simd<64>(OUT(0));
1912 else if (xa == 1.f)
1913 nova::copyvec_simd<64>(OUT(0), IN(1));
1914 else
1915 nova::times_vec_simd<64>(OUT(0), IN(1), xa);
1916 } else {
1917 float slope = CALCSLOPE(next_a, xa);
1918 unit->mPrevA = next_a;
1920 nova::times_vec_simd(OUT(0), IN(1), slope_argument(xa, slope), inNumSamples);
1924 FLATTEN void mul_ak_nova(BinaryOpUGen *unit, int inNumSamples)
1926 float xb = unit->mPrevB;
1927 float next_b = ZIN0(1);
1929 if (xb == next_b) {
1930 if (xb == 0.f)
1931 nova::zerovec_simd(OUT(0), inNumSamples);
1932 else if (xb == 1.f)
1933 nova::copyvec_simd(OUT(0), IN(0), inNumSamples);
1934 else
1935 nova::times_vec_simd(OUT(0), IN(0), xb, inNumSamples);
1936 } else {
1937 float slope = CALCSLOPE(next_b, xb);
1938 unit->mPrevB = next_b;
1940 nova::times_vec_simd(OUT(0), IN(0), slope_argument(xb, slope), inNumSamples);
1944 FLATTEN void mul_ak_nova_64(BinaryOpUGen *unit, int inNumSamples)
1946 float xb = unit->mPrevB;
1947 float next_b = ZIN0(1);
1949 if (xb == next_b) {
1950 if (xb == 0.f)
1951 nova::zerovec_simd<64>(OUT(0));
1952 else if (xb == 1.f)
1953 nova::copyvec_simd<64>(OUT(0), IN(0));
1954 else
1955 nova::times_vec_simd<64>(OUT(0), IN(0), xb);
1956 } else {
1957 float slope = CALCSLOPE(next_b, xb);
1958 unit->mPrevB = next_b;
1960 nova::times_vec_simd(OUT(0), IN(0), slope_argument(xb, slope), inNumSamples);
1964 #endif
1967 void div_aa(BinaryOpUGen *unit, int inNumSamples)
1969 float *out = ZOUT(0);
1970 float *a = ZIN(0);
1971 float *b = ZIN(1);
1973 LOOP1(inNumSamples,
1974 ZXP(out) = ZXP(a) / ZXP(b);
1978 void div_ak(BinaryOpUGen *unit, int inNumSamples)
1980 float *out = ZOUT(0);
1981 float *a = ZIN(0);
1982 float xb = unit->mPrevB;
1983 float next_b = ZIN0(1);
1985 if (xb == next_b) {
1986 if (xb == 0.f) {
1987 ZClear(inNumSamples, out);
1988 } else if (xb == 1.f) {
1989 ZCopy(inNumSamples, out, a);
1990 } else {
1991 float recip = 1.f/ xb;
1992 LOOP1(inNumSamples,
1993 ZXP(out) = ZXP(a) * recip;
1996 } else {
1997 float slope = CALCSLOPE(next_b, xb);
1998 LOOP1(inNumSamples,
1999 ZXP(out) = ZXP(a) / xb;
2000 xb += slope;
2002 unit->mPrevB = xb;
2006 void div_ka(BinaryOpUGen *unit, int inNumSamples)
2008 float *out = ZOUT(0);
2009 float xa = unit->mPrevA;
2010 float *b = ZIN(1);
2011 float next_a = ZIN0(0);
2013 if (xa == next_a) {
2014 if (xa == 0.f) {
2015 ZClear(inNumSamples, out);
2016 } else {
2017 LOOP1(inNumSamples,
2018 ZXP(out) = xa / ZXP(b);
2021 } else {
2022 float slope = CALCSLOPE(next_a, xa);
2023 LOOP1(inNumSamples,
2024 ZXP(out) = xa / ZXP(b);
2025 xa += slope;
2027 unit->mPrevA = xa;
2031 void div_ia(BinaryOpUGen *unit, int inNumSamples)
2033 float *out = ZOUT(0);
2034 float xa = ZIN0(0);
2035 float *b = ZIN(1);
2037 LOOP1(inNumSamples,
2038 ZXP(out) = xa / ZXP(b);
2040 unit->mPrevA = xa;
2044 void div_ai(BinaryOpUGen *unit, int inNumSamples)
2046 float *out = ZOUT(0);
2047 float *a = ZIN(0);
2048 float xb = ZIN0(1);
2050 float rxb = 1.f / xb;
2051 LOOP1(inNumSamples,
2052 ZXP(out) = ZXP(a) * rxb;
2054 unit->mPrevB = xb;
2057 #ifdef NOVA_SIMD
2058 FLATTEN void div_aa_nova(BinaryOpUGen *unit, int inNumSamples)
2060 nova::over_vec_simd(OUT(0), IN(0), IN(1), inNumSamples);
2063 FLATTEN void div_ia_nova(BinaryOpUGen *unit, int inNumSamples)
2065 float xa = ZIN0(0);
2067 nova::over_vec_simd(OUT(0), xa, IN(1), inNumSamples);
2068 unit->mPrevA = xa;
2071 FLATTEN void div_ai_nova(BinaryOpUGen *unit, int inNumSamples)
2073 float xb = ZIN0(1);
2075 nova::times_vec_simd(OUT(0), IN(0), sc_reciprocal(xb), inNumSamples);
2076 unit->mPrevB = xb;
2079 FLATTEN void div_ak_nova(BinaryOpUGen *unit, int inNumSamples)
2081 float xb = unit->mPrevB;
2082 float next_b = ZIN0(1);
2084 if (xb == next_b) {
2085 if (xb == 0.f)
2086 nova::zerovec_simd(OUT(0), inNumSamples);
2087 else if (xb == 1.f)
2088 nova::copyvec_simd(OUT(0), IN(0), inNumSamples);
2089 else {
2090 float recip = 1.f / xb;
2091 nova::times_vec_simd(OUT(0), IN(0), recip, inNumSamples);
2093 } else {
2094 float slope = CALCSLOPE(next_b, xb);
2095 nova::over_vec_simd(OUT(0), IN(0), slope_argument(xb, slope), inNumSamples);
2096 unit->mPrevB = next_b;
2100 FLATTEN void div_ka_nova(BinaryOpUGen *unit, int inNumSamples)
2102 float xa = unit->mPrevA;
2103 float next_a = ZIN0(0);
2105 if (xa == next_a) {
2106 if (xa == 0.f)
2107 nova::zerovec_simd(OUT(0), inNumSamples);
2108 else
2109 nova::over_vec_simd(OUT(0), xa, IN(1), inNumSamples);
2110 } else {
2111 float slope = CALCSLOPE(next_a, xa);
2112 nova::over_vec_simd(OUT(0), slope_argument(xa, slope), IN(1), inNumSamples);
2113 unit->mPrevA = xa;
2117 #endif
2123 void mod_aa(BinaryOpUGen *unit, int inNumSamples)
2125 float *out = ZOUT(0);
2126 float *a = ZIN(0);
2127 float *b = ZIN(1);
2129 LOOP1(inNumSamples,
2130 float xa = ZXP(a);
2131 float xb = ZXP(b);
2132 ZXP(out) = sc_mod(xa, xb);
2136 void mod_ak(BinaryOpUGen *unit, int inNumSamples)
2138 float *out = ZOUT(0);
2139 float *a = ZIN(0);
2140 float xb = unit->mPrevB;
2141 float next_b = ZIN0(1);
2143 if (xb == next_b) {
2144 if (xb == 0.f) {
2145 ZCopy(inNumSamples, out, a);
2146 } else {
2147 LOOP1(inNumSamples,
2148 ZXP(out) = sc_mod(ZXP(a), xb);
2151 } else {
2152 float slope = CALCSLOPE(next_b, xb);
2153 LOOP1(inNumSamples,
2154 ZXP(out) = sc_mod(ZXP(a), xb);
2155 xb += slope;
2157 unit->mPrevB = xb;
2161 void mod_ka(BinaryOpUGen *unit, int inNumSamples)
2163 float *out = ZOUT(0);
2164 float xa = unit->mPrevA;
2165 float *b = ZIN(1);
2166 float next_a = ZIN0(0);
2168 if (xa == next_a) {
2169 if (xa == 0.f) {
2170 ZClear(inNumSamples, out);
2171 } else {
2172 LOOP1(inNumSamples,
2173 ZXP(out) = sc_mod(xa, ZXP(b));
2176 } else {
2177 float slope = CALCSLOPE(next_a, xa);
2178 LOOP1(inNumSamples,
2179 ZXP(out) = sc_mod(xa, ZXP(b));
2180 xa += slope;
2182 unit->mPrevA = xa;
2187 void mod_ia(BinaryOpUGen *unit, int inNumSamples)
2189 float *out = ZOUT(0);
2190 float xa = ZIN0(0);
2191 float *b = ZIN(1);
2193 LOOP1(inNumSamples,
2194 ZXP(out) = sc_mod(xa, ZXP(b));
2196 unit->mPrevA = xa;
2200 void mod_ai(BinaryOpUGen *unit, int inNumSamples)
2202 float *out = ZOUT(0);
2203 float *a = ZIN(0);
2204 float xb = ZIN0(1);
2206 LOOP1(inNumSamples,
2207 ZXP(out) = sc_mod(ZXP(a), xb);
2209 unit->mPrevB = xb;
2214 void max_aa(BinaryOpUGen *unit, int inNumSamples)
2216 float *out = ZOUT(0);
2217 float *a = ZIN(0);
2218 float *b = ZIN(1);
2220 LOOP1(inNumSamples,
2221 float xa = ZXP(a);
2222 float xb = ZXP(b);
2223 ZXP(out) = sc_max(xa, xb);
2227 void max_ak(BinaryOpUGen *unit, int inNumSamples)
2229 float *out = ZOUT(0);
2230 float *a = ZIN(0);
2231 float xb = unit->mPrevB;
2232 float next_b = ZIN0(1);
2234 if (xb == next_b) {
2235 LOOP1(inNumSamples,
2236 float xa = ZXP(a);
2237 ZXP(out) = sc_max(xa, xb);
2239 } else {
2240 float slope = CALCSLOPE(next_b, xb);
2241 LOOP1(inNumSamples,
2242 float xa = ZXP(a);
2243 ZXP(out) = sc_max(xa, xb);
2244 xb += slope;
2246 unit->mPrevB = xb;
2250 void max_ka(BinaryOpUGen *unit, int inNumSamples)
2252 float *out = ZOUT(0);
2253 float xa = unit->mPrevA;
2254 float *b = ZIN(1);
2255 float next_a = ZIN0(0);
2257 if (xa == next_a) {
2258 LOOP1(inNumSamples,
2259 float xb = ZXP(b);
2260 ZXP(out) = sc_max(xa, xb);
2262 } else {
2263 float slope = CALCSLOPE(next_a, xa);
2264 LOOP1(inNumSamples,
2265 float xb = ZXP(b);
2266 ZXP(out) = sc_max(xa, xb);
2267 xa += slope;
2269 unit->mPrevA = xa;
2273 void max_ia(BinaryOpUGen *unit, int inNumSamples)
2275 float *out = ZOUT(0);
2276 float xa = ZIN0(0);
2277 float *b = ZIN(1);
2279 LOOP1(inNumSamples,
2280 float xb = ZXP(b);
2281 ZXP(out) = sc_max(xa, xb);
2283 unit->mPrevA = xa;
2287 void max_ai(BinaryOpUGen *unit, int inNumSamples)
2289 float *out = ZOUT(0);
2290 float *a = ZIN(0);
2291 float xb = ZIN0(1);
2293 LOOP1(inNumSamples,
2294 float xa = ZXP(a);
2295 ZXP(out) = sc_max(xa, xb);
2297 unit->mPrevB = xb;
2300 #ifdef NOVA_SIMD
2301 NOVA_BINARY_WRAPPER_K(max, max)
2302 #endif
2307 void min_aa(BinaryOpUGen *unit, int inNumSamples)
2309 float *out = ZOUT(0);
2310 float *a = ZIN(0);
2311 float *b = ZIN(1);
2313 LOOP1(inNumSamples,
2314 float xa = ZXP(a);
2315 float xb = ZXP(b);
2316 ZXP(out) = sc_min(xa, xb);
2320 void min_ak(BinaryOpUGen *unit, int inNumSamples)
2322 float *out = ZOUT(0);
2323 float *a = ZIN(0);
2324 float xb = unit->mPrevB;
2325 float next_b = ZIN0(1);
2327 if (xb == next_b) {
2328 LOOP1(inNumSamples,
2329 float xa = ZXP(a);
2330 ZXP(out) = sc_min(xa, xb);
2332 } else {
2333 float slope = CALCSLOPE(next_b, xb);
2334 LOOP1(inNumSamples,
2335 float xa = ZXP(a);
2336 ZXP(out) = sc_min(xa, xb);
2337 xb += slope;
2339 unit->mPrevB = xb;
2343 void min_ka(BinaryOpUGen *unit, int inNumSamples)
2345 float *out = ZOUT(0);
2346 float xa = unit->mPrevA;
2347 float *b = ZIN(1);
2348 float next_a = ZIN0(0);
2350 if (xa == next_a) {
2351 LOOP1(inNumSamples,
2352 float xb = ZXP(b);
2353 ZXP(out) = sc_min(xa, xb);
2355 } else {
2356 float slope = CALCSLOPE(next_a, xa);
2357 LOOP1(inNumSamples,
2358 float xb = ZXP(b);
2359 ZXP(out) = sc_min(xa, xb);
2360 xa += slope;
2362 unit->mPrevA = xa;
2366 void min_ia(BinaryOpUGen *unit, int inNumSamples)
2368 float *out = ZOUT(0);
2369 float xa = ZIN0(0);
2370 float *b = ZIN(1);
2372 LOOP1(inNumSamples,
2373 float xb = ZXP(b);
2374 ZXP(out) = sc_min(xa, xb);
2376 unit->mPrevA = xa;
2380 void min_ai(BinaryOpUGen *unit, int inNumSamples)
2382 float *out = ZOUT(0);
2383 float *a = ZIN(0);
2384 float xb = ZIN0(1);
2386 LOOP1(inNumSamples,
2387 float xa = ZXP(a);
2388 ZXP(out) = sc_min(xa, xb);
2390 unit->mPrevB = xb;
2394 #ifdef NOVA_SIMD
2395 NOVA_BINARY_WRAPPER_K(min, min)
2396 #endif
2399 void and_aa(BinaryOpUGen *unit, int inNumSamples)
2401 float *out = ZOUT(0);
2402 float *a = ZIN(0);
2403 float *b = ZIN(1);
2405 LOOP1(inNumSamples,
2406 float xa = ZXP(a);
2407 float xb = ZXP(b);
2408 ZXP(out) = sc_andt(xa, xb) ;
2412 void and_ak(BinaryOpUGen *unit, int inNumSamples)
2414 float *out = ZOUT(0);
2415 float *a = ZIN(0);
2416 float xb = unit->mPrevB;
2417 float next_b = ZIN0(1);
2419 if (xb == next_b) {
2420 LOOP1(inNumSamples,
2421 float xa = ZXP(a);
2422 ZXP(out) = sc_andt(xa, xb);
2424 } else {
2425 float slope = CALCSLOPE(next_b, xb);
2426 LOOP1(inNumSamples,
2427 float xa = ZXP(a);
2428 ZXP(out) = sc_andt(xa, xb);
2429 xb += slope;
2431 unit->mPrevB = xb;
2435 void and_ka(BinaryOpUGen *unit, int inNumSamples)
2437 float *out = ZOUT(0);
2438 float xa = unit->mPrevA;
2439 float *b = ZIN(1);
2440 float next_a = ZIN0(0);
2442 if (xa == next_a) {
2443 LOOP1(inNumSamples,
2444 float xb = ZXP(b);
2445 ZXP(out) = sc_andt(xa, xb);
2447 } else {
2448 float slope = CALCSLOPE(next_a, xa);
2449 LOOP1(inNumSamples,
2450 float xb = ZXP(b);
2451 ZXP(out) = sc_andt(xa, xb);
2452 xa += slope;
2454 unit->mPrevA = xa;
2458 void and_ia(BinaryOpUGen *unit, int inNumSamples)
2460 float *out = ZOUT(0);
2461 float xa = ZIN0(0);
2462 float *b = ZIN(1);
2464 LOOP1(inNumSamples,
2465 float xb = ZXP(b);
2466 ZXP(out) = sc_andt(xa, xb);
2468 unit->mPrevA = xa;
2472 void and_ai(BinaryOpUGen *unit, int inNumSamples)
2474 float *out = ZOUT(0);
2475 float *a = ZIN(0);
2476 float xb = ZIN0(1);
2478 LOOP1(inNumSamples,
2479 float xa = ZXP(a);
2480 ZXP(out) = sc_andt(xa, xb);
2482 unit->mPrevB = xb;
2491 void or_aa(BinaryOpUGen *unit, int inNumSamples)
2493 float *out = ZOUT(0);
2494 float *a = ZIN(0);
2495 float *b = ZIN(1);
2497 LOOP1(inNumSamples,
2498 float xa = ZXP(a);
2499 float xb = ZXP(b);
2500 ZXP(out) = sc_ort(xa, xb) ;
2504 void or_ak(BinaryOpUGen *unit, int inNumSamples)
2506 float *out = ZOUT(0);
2507 float *a = ZIN(0);
2508 float xb = unit->mPrevB;
2509 float next_b = ZIN0(1);
2511 if (xb == next_b) {
2512 LOOP1(inNumSamples,
2513 float xa = ZXP(a);
2514 ZXP(out) = sc_ort(xa, xb);
2516 } else {
2517 float slope = CALCSLOPE(next_b, xb);
2518 LOOP1(inNumSamples,
2519 float xa = ZXP(a);
2520 ZXP(out) = sc_ort(xa, xb);
2521 xb += slope;
2523 unit->mPrevB = xb;
2527 void or_ka(BinaryOpUGen *unit, int inNumSamples)
2529 float *out = ZOUT(0);
2530 float xa = unit->mPrevA;
2531 float *b = ZIN(1);
2532 float next_a = ZIN0(0);
2534 if (xa == next_a) {
2535 LOOP1(inNumSamples,
2536 float xb = ZXP(b);
2537 ZXP(out) = sc_ort(xa, xb);
2539 } else {
2540 float slope = CALCSLOPE(next_a, xa);
2541 LOOP1(inNumSamples,
2542 float xb = ZXP(b);
2543 ZXP(out) = sc_ort(xa, xb);
2544 xa += slope;
2546 unit->mPrevA = xa;
2550 void or_ia(BinaryOpUGen *unit, int inNumSamples)
2552 float *out = ZOUT(0);
2553 float xa = ZIN0(0);
2554 float *b = ZIN(1);
2556 LOOP1(inNumSamples,
2557 float xb = ZXP(b);
2558 ZXP(out) = sc_ort(xa, xb);
2560 unit->mPrevA = xa;
2564 void or_ai(BinaryOpUGen *unit, int inNumSamples)
2566 float *out = ZOUT(0);
2567 float *a = ZIN(0);
2568 float xb = ZIN0(1);
2570 LOOP1(inNumSamples,
2571 float xa = ZXP(a);
2572 ZXP(out) = sc_ort(xa, xb);
2574 unit->mPrevB = xb;
2583 void xor_aa(BinaryOpUGen *unit, int inNumSamples)
2585 float *out = ZOUT(0);
2586 float *a = ZIN(0);
2587 float *b = ZIN(1);
2589 LOOP1(inNumSamples,
2590 float xa = ZXP(a);
2591 float xb = ZXP(b);
2592 ZXP(out) = sc_xort(xa, xb) ;
2596 void xor_ak(BinaryOpUGen *unit, int inNumSamples)
2598 float *out = ZOUT(0);
2599 float *a = ZIN(0);
2600 float xb = unit->mPrevB;
2601 float next_b = ZIN0(1);
2603 if (xb == next_b) {
2604 LOOP1(inNumSamples,
2605 float xa = ZXP(a);
2606 ZXP(out) = sc_xort(xa, xb);
2608 } else {
2609 float slope = CALCSLOPE(next_b, xb);
2610 LOOP1(inNumSamples,
2611 float xa = ZXP(a);
2612 ZXP(out) = sc_xort(xa, xb);
2613 xb += slope;
2615 unit->mPrevB = xb;
2619 void xor_ka(BinaryOpUGen *unit, int inNumSamples)
2621 float *out = ZOUT(0);
2622 float xa = unit->mPrevA;
2623 float *b = ZIN(1);
2624 float next_a = ZIN0(0);
2626 if (xa == next_a) {
2627 LOOP1(inNumSamples,
2628 float xb = ZXP(b);
2629 ZXP(out) = sc_xort(xa, xb);
2631 } else {
2632 float slope = CALCSLOPE(next_a, xa);
2633 LOOP1(inNumSamples,
2634 float xb = ZXP(b);
2635 ZXP(out) = sc_xort(xa, xb);
2636 xa += slope;
2638 unit->mPrevA = xa;
2642 void xor_ia(BinaryOpUGen *unit, int inNumSamples)
2644 float *out = ZOUT(0);
2645 float xa = ZIN0(0);
2646 float *b = ZIN(1);
2648 LOOP1(inNumSamples,
2649 float xb = ZXP(b);
2650 ZXP(out) = sc_xort(xa, xb);
2652 unit->mPrevA = xa;
2656 void xor_ai(BinaryOpUGen *unit, int inNumSamples)
2658 float *out = ZOUT(0);
2659 float *a = ZIN(0);
2660 float xb = ZIN0(1);
2662 LOOP1(inNumSamples,
2663 float xa = ZXP(a);
2664 ZXP(out) = sc_xort(xa, xb);
2666 unit->mPrevB = xb;
2672 void rightShift_aa(BinaryOpUGen *unit, int inNumSamples)
2674 float *out = ZOUT(0);
2675 float *a = ZIN(0);
2676 float *b = ZIN(1);
2678 LOOP1(inNumSamples,
2679 float xa = ZXP(a);
2680 float xb = ZXP(b);
2681 ZXP(out) = sc_rst(xa, xb) ;
2685 void rightShift_ak(BinaryOpUGen *unit, int inNumSamples)
2687 float *out = ZOUT(0);
2688 float *a = ZIN(0);
2689 float xb = unit->mPrevB;
2690 float next_b = ZIN0(1);
2692 if (xb == next_b) {
2693 LOOP1(inNumSamples,
2694 float xa = ZXP(a);
2695 ZXP(out) = sc_rst(xa, xb);
2697 } else {
2698 float slope = CALCSLOPE(next_b, xb);
2699 LOOP1(inNumSamples,
2700 float xa = ZXP(a);
2701 ZXP(out) = sc_rst(xa, xb);
2702 xb += slope;
2704 unit->mPrevB = xb;
2708 void rightShift_ka(BinaryOpUGen *unit, int inNumSamples)
2710 float *out = ZOUT(0);
2711 float xa = unit->mPrevA;
2712 float *b = ZIN(1);
2713 float next_a = ZIN0(0);
2715 if (xa == next_a) {
2716 LOOP1(inNumSamples,
2717 float xb = ZXP(b);
2718 ZXP(out) = sc_rst(xa, xb);
2720 } else {
2721 float slope = CALCSLOPE(next_a, xa);
2722 LOOP1(inNumSamples,
2723 float xb = ZXP(b);
2724 ZXP(out) = sc_rst(xa, xb);
2725 xa += slope;
2727 unit->mPrevA = xa;
2731 void rightShift_ia(BinaryOpUGen *unit, int inNumSamples)
2733 float *out = ZOUT(0);
2734 float xa = ZIN0(0);
2735 float *b = ZIN(1);
2737 LOOP1(inNumSamples,
2738 float xb = ZXP(b);
2739 ZXP(out) = sc_rst(xa, xb);
2741 unit->mPrevA = xa;
2745 void rightShift_ai(BinaryOpUGen *unit, int inNumSamples)
2747 float *out = ZOUT(0);
2748 float *a = ZIN(0);
2749 float xb = ZIN0(1);
2751 LOOP1(inNumSamples,
2752 float xa = ZXP(a);
2753 ZXP(out) = sc_rst(xa, xb);
2755 unit->mPrevB = xb;
2760 void leftShift_aa(BinaryOpUGen *unit, int inNumSamples)
2762 float *out = ZOUT(0);
2763 float *a = ZIN(0);
2764 float *b = ZIN(1);
2766 LOOP1(inNumSamples,
2767 float xa = ZXP(a);
2768 float xb = ZXP(b);
2769 ZXP(out) = sc_lst(xa, xb) ;
2773 void leftShift_ak(BinaryOpUGen *unit, int inNumSamples)
2775 float *out = ZOUT(0);
2776 float *a = ZIN(0);
2777 float xb = unit->mPrevB;
2778 float next_b = ZIN0(1);
2780 if (xb == next_b) {
2781 LOOP1(inNumSamples,
2782 float xa = ZXP(a);
2783 ZXP(out) = sc_lst(xa, xb);
2785 } else {
2786 float slope = CALCSLOPE(next_b, xb);
2787 LOOP1(inNumSamples,
2788 float xa = ZXP(a);
2789 ZXP(out) = sc_lst(xa, xb);
2790 xb += slope;
2792 unit->mPrevB = xb;
2796 void leftShift_ka(BinaryOpUGen *unit, int inNumSamples)
2798 float *out = ZOUT(0);
2799 float xa = unit->mPrevA;
2800 float *b = ZIN(1);
2801 float next_a = ZIN0(0);
2803 if (xa == next_a) {
2804 LOOP1(inNumSamples,
2805 float xb = ZXP(b);
2806 ZXP(out) = sc_lst(xa, xb);
2808 } else {
2809 float slope = CALCSLOPE(next_a, xa);
2810 LOOP1(inNumSamples,
2811 float xb = ZXP(b);
2812 ZXP(out) = sc_lst(xa, xb);
2813 xa += slope;
2815 unit->mPrevA = xa;
2819 void leftShift_ia(BinaryOpUGen *unit, int inNumSamples)
2821 float *out = ZOUT(0);
2822 float xa = ZIN0(0);
2823 float *b = ZIN(1);
2825 LOOP1(inNumSamples,
2826 float xb = ZXP(b);
2827 ZXP(out) = sc_lst(xa, xb);
2829 unit->mPrevA = xa;
2833 void leftShift_ai(BinaryOpUGen *unit, int inNumSamples)
2835 float *out = ZOUT(0);
2836 float *a = ZIN(0);
2837 float xb = ZIN0(1);
2839 LOOP1(inNumSamples,
2840 float xa = ZXP(a);
2841 ZXP(out) = sc_lst(xa, xb);
2843 unit->mPrevB = xb;
2850 void amclip_aa(BinaryOpUGen *unit, int inNumSamples)
2852 float *out = ZOUT(0);
2853 float *a = ZIN(0);
2854 float *b = ZIN(1);
2856 LOOP1(inNumSamples,
2857 float xa = ZXP(a);
2858 float xb = ZXP(b);
2859 ZXP(out) = sc_amclip(xa, xb);
2863 void amclip_ak(BinaryOpUGen *unit, int inNumSamples)
2865 float *out = ZOUT(0);
2866 float *a = ZIN(0);
2867 float xb = unit->mPrevB;
2868 float next_b = ZIN0(1);
2870 if (xb == next_b) {
2871 if (xb > 0.f) {
2872 LOOP1(inNumSamples,
2873 ZXP(out) = ZXP(a) * xb;
2875 } else {
2876 ZClear(inNumSamples, out);
2878 } else {
2879 float slope = CALCSLOPE(next_b, xb);
2880 LOOP1(inNumSamples,
2881 float xa = ZXP(a);
2882 ZXP(out) = sc_amclip(xa, xb);
2883 xb += slope;
2885 unit->mPrevB = xb;
2889 void amclip_ka(BinaryOpUGen *unit, int inNumSamples)
2891 float *out = ZOUT(0);
2892 float xa = unit->mPrevA;
2893 float *b = ZIN(1);
2894 float next_a = ZIN0(0);
2896 if (xa == next_a) {
2897 LOOP1(inNumSamples,
2898 float xb = ZXP(b);
2899 ZXP(out) = sc_amclip(xa, xb);
2901 } else {
2902 float slope = CALCSLOPE(next_a, xa);
2903 LOOP1(inNumSamples,
2904 float xb = ZXP(b);
2905 ZXP(out) = sc_amclip(xa, xb);
2906 xa += slope;
2908 unit->mPrevA = xa;
2912 void amclip_ia(BinaryOpUGen *unit, int inNumSamples)
2914 float *out = ZOUT(0);
2915 float xa = ZIN0(0);
2916 float *b = ZIN(1);
2918 LOOP1(inNumSamples,
2919 float xb = ZXP(b);
2920 ZXP(out) = sc_amclip(xa, xb);
2922 unit->mPrevA = xa;
2926 void amclip_ai(BinaryOpUGen *unit, int inNumSamples)
2928 float *out = ZOUT(0);
2929 float *a = ZIN(0);
2930 float xb = ZIN0(1);
2932 LOOP1(inNumSamples,
2933 float xa = ZXP(a);
2934 ZXP(out) = sc_amclip(xa, xb);
2936 unit->mPrevB = xb;
2941 void scaleneg_aa(BinaryOpUGen *unit, int inNumSamples)
2943 float *out = ZOUT(0);
2944 float *a = ZIN(0);
2945 float *b = ZIN(1);
2947 LOOP1(inNumSamples,
2948 float xa = ZXP(a);
2949 float xb = ZXP(b);
2950 ZXP(out) = xa >= 0.f ? xa : xa * xb;
2954 void scaleneg_ak(BinaryOpUGen *unit, int inNumSamples)
2956 float *out = ZOUT(0);
2957 float *a = ZIN(0);
2958 float xb = unit->mPrevB;
2959 float next_b = ZIN0(1);
2961 if (xb == next_b) {
2962 LOOP1(inNumSamples,
2963 float xa = ZXP(a);
2964 ZXP(out) = xa >= 0.f ? xa : xa * xb;
2966 } else {
2967 float slope = CALCSLOPE(next_b, xb);
2968 LOOP1(inNumSamples,
2969 float xa = ZXP(a);
2970 ZXP(out) = xa >= 0.f ? xa : xa * xb;
2971 xb += slope;
2973 unit->mPrevB = xb;
2977 void scaleneg_ka(BinaryOpUGen *unit, int inNumSamples)
2979 float *out = ZOUT(0);
2980 float xa = unit->mPrevA;
2981 float *b = ZIN(1);
2982 float next_a = ZIN0(0);
2984 if (xa == next_a) {
2985 if (xa >= 0.f) {
2986 LOOP1(inNumSamples,
2987 ZXP(out) = xa;
2989 } else {
2990 LOOP1(inNumSamples,
2991 ZXP(out) = xa * ZXP(b);
2994 } else {
2995 float slope = CALCSLOPE(next_a, xa);
2996 LOOP1(inNumSamples,
2997 float xb = ZXP(b);
2998 ZXP(out) = xa >= 0.f ? xa : xa * xb;
2999 xa += slope;
3001 unit->mPrevA = xa;
3005 void scaleneg_ia(BinaryOpUGen *unit, int inNumSamples)
3007 float *out = ZOUT(0);
3008 float xa = ZIN0(0);
3009 float *b = ZIN(1);
3011 LOOP1(inNumSamples,
3012 float xb = ZXP(b);
3013 ZXP(out) = xa >= 0.f ? xa : xa * xb;
3015 unit->mPrevA = xa;
3019 void scaleneg_ai(BinaryOpUGen *unit, int inNumSamples)
3021 float *out = ZOUT(0);
3022 float *a = ZIN(0);
3023 float xb = ZIN0(1);
3025 LOOP1(inNumSamples,
3026 float xa = ZXP(a);
3027 ZXP(out) = xa >= 0.f ? xa : xa * xb;
3029 unit->mPrevB = xb;
3035 void pow_aa(BinaryOpUGen *unit, int inNumSamples)
3037 float *out = ZOUT(0);
3038 float *a = ZIN(0);
3039 float *b = ZIN(1);
3041 LOOP1(inNumSamples,
3042 float xa = ZXP(a);
3043 float xb = ZXP(b);
3044 ZXP(out) = xa >= 0.f ? pow(xa, xb) : -pow(-xa, xb);
3049 void pow_ak(BinaryOpUGen *unit, int inNumSamples)
3051 float *out = ZOUT(0);
3052 float *a = ZIN(0);
3053 float xb = unit->mPrevB;
3054 float next_b = ZIN0(1);
3056 if (xb == next_b) {
3057 LOOP1(inNumSamples,
3058 float xa = ZXP(a);
3059 ZXP(out) = xa >= 0.f ? pow(xa, xb) : -pow(-xa, xb);
3061 } else {
3062 float slope = CALCSLOPE(next_b, xb);
3063 LOOP1(inNumSamples,
3064 float xa = ZXP(a);
3065 ZXP(out) = xa >= 0.f ? pow(xa, xb) : -pow(-xa, xb);
3066 xb += slope;
3068 unit->mPrevB = xb;
3072 void pow_ka(BinaryOpUGen *unit, int inNumSamples)
3074 float *out = ZOUT(0);
3075 float xa = unit->mPrevA;
3076 float *b = ZIN(1);
3077 float next_a = ZIN0(0);
3079 if (xa == next_a) {
3080 if (xa >= 0.f) {
3081 LOOP1(inNumSamples,
3082 float xb = ZXP(b);
3083 ZXP(out) = pow(xa, xb);
3085 } else {
3086 LOOP1(inNumSamples,
3087 float xb = ZXP(b);
3088 ZXP(out) = -pow(-xa, xb);
3091 } else {
3092 float slope = CALCSLOPE(next_a, xa);
3093 LOOP1(inNumSamples,
3094 float xb = ZXP(b);
3095 ZXP(out) = xa >= 0.f ? pow(xa, xb) : -pow(-xa, xb);
3096 xa += slope;
3098 unit->mPrevA = xa;
3102 void pow_ia(BinaryOpUGen *unit, int inNumSamples)
3104 float *out = ZOUT(0);
3105 float xa = ZIN0(0);
3106 float *b = ZIN(1);
3108 LOOP1(inNumSamples,
3109 float xb = ZXP(b);
3110 ZXP(out) = xa >= 0.f ? pow(xa, xb) : -pow(-xa, xb);
3112 unit->mPrevA = xa;
3116 void pow_ai(BinaryOpUGen *unit, int inNumSamples)
3118 float *out = ZOUT(0);
3119 float *a = ZIN(0);
3120 float xb = ZIN0(1);
3122 LOOP1(inNumSamples,
3123 float xa = ZXP(a);
3124 ZXP(out) = xa >= 0.f ? pow(xa, xb) : -pow(-xa, xb);
3126 unit->mPrevB = xb;
3129 #ifdef NOVA_SIMD
3130 FLATTEN void pow_aa_nova(BinaryOpUGen *unit, int inNumSamples)
3132 nova::spow_vec_simd(OUT(0), IN(0), IN(1), inNumSamples);
3135 FLATTEN void pow_ak_nova(BinaryOpUGen *unit, int inNumSamples)
3137 float *out = ZOUT(0);
3138 float *a = ZIN(0);
3139 float xb = unit->mPrevB;
3140 float next_b = ZIN0(1);
3142 if (xb == next_b)
3143 nova::spow_vec_simd(OUT(0), IN(0), xb, inNumSamples);
3144 else {
3145 float slope = CALCSLOPE(next_b, xb);
3146 nova::spow_vec_simd(OUT(0), IN(0), slope_argument(xb, slope), inNumSamples);
3147 unit->mPrevB = next_b;
3151 FLATTEN void pow_ka_nova(BinaryOpUGen *unit, int inNumSamples)
3153 float *out = ZOUT(0);
3154 float xa = unit->mPrevA;
3155 float *b = ZIN(1);
3156 float next_a = ZIN0(0);
3158 if (xa == next_a) {
3159 if (xa >= 0.f)
3160 nova::pow_vec_simd(OUT(0), xa, IN(1), inNumSamples);
3161 else
3162 nova::spow_vec_simd(OUT(0), xa, IN(1), inNumSamples);
3163 } else {
3164 float slope = CALCSLOPE(next_a, xa);
3165 nova::spow_vec_simd(OUT(0), slope_argument(xa, slope), IN(1), inNumSamples);
3166 unit->mPrevA = next_a;
3171 FLATTEN void pow_ia_nova(BinaryOpUGen *unit, int inNumSamples)
3173 float xa = ZIN0(0);
3174 if (xa > 0.f)
3175 nova::pow_vec_simd(OUT(0), xa, IN(1), inNumSamples);
3176 else
3177 nova::spow_vec_simd(OUT(0), xa, IN(1), inNumSamples);
3178 unit->mPrevA = xa;
3182 FLATTEN void pow_ai_nova(BinaryOpUGen *unit, int inNumSamples)
3184 float xb = ZIN0(1);
3185 nova::spow_vec_simd(OUT(0), IN(0), xb, inNumSamples);
3187 #endif
3190 void ring1_aa(BinaryOpUGen *unit, int inNumSamples)
3192 float *out = ZOUT(0);
3193 float *a = ZIN(0);
3194 float *b = ZIN(1);
3196 LOOP1(inNumSamples,
3197 float xa = ZXP(a);
3198 float xb = ZXP(b);
3199 ZXP(out) = xa * xb + xa;
3203 void ring1_ak(BinaryOpUGen *unit, int inNumSamples)
3205 float *out = ZOUT(0);
3206 float *a = ZIN(0);
3207 float xb = unit->mPrevB;
3208 float next_b = ZIN0(1);
3210 if (xb == next_b) {
3211 if (xb == 0.f) {
3212 ZCopy(inNumSamples, out, a);
3213 } else if (xb == 1.f) {
3214 LOOP1(inNumSamples,
3215 float xa = ZXP(a);
3216 ZXP(out) = xa + xa;
3218 } else {
3219 LOOP1(inNumSamples,
3220 float xa = ZXP(a);
3221 ZXP(out) = xa * xb + xa;
3224 } else {
3225 float slope = CALCSLOPE(next_b, xb);
3226 LOOP1(inNumSamples,
3227 float xa = ZXP(a);
3228 ZXP(out) = xa * xb + xa;
3229 xb += slope;
3231 unit->mPrevB = xb;
3235 void ring1_ka(BinaryOpUGen *unit, int inNumSamples)
3237 float *out = ZOUT(0);
3238 float xa = unit->mPrevA;
3239 float *b = ZIN(1);
3240 float next_a = ZIN0(0);
3242 if (xa == next_a) {
3243 if (xa == 0.f) {
3244 LOOP1(inNumSamples,
3245 ZXP(out) = 0.f;
3247 } else {
3248 LOOP1(inNumSamples,
3249 float xb = ZXP(b);
3250 ZXP(out) = xa * xb + xa;
3253 } else {
3254 float slope = CALCSLOPE(next_a, xa);
3255 LOOP1(inNumSamples,
3256 float xb = ZXP(b);
3257 ZXP(out) = xa * xb + xa;
3258 xa += slope;
3260 unit->mPrevA = xa;
3264 void ring1_ia(BinaryOpUGen *unit, int inNumSamples)
3266 float *out = ZOUT(0);
3267 float xa = ZIN0(0);
3268 float *b = ZIN(1);
3270 LOOP1(inNumSamples,
3271 float xb = ZXP(b);
3272 ZXP(out) = xa * xb + xa;
3274 unit->mPrevA = xa;
3278 void ring1_ai(BinaryOpUGen *unit, int inNumSamples)
3280 float *out = ZOUT(0);
3281 float *a = ZIN(0);
3282 float xb = ZIN0(1);
3284 LOOP1(inNumSamples,
3285 float xa = ZXP(a);
3286 ZXP(out) = xa * xb + xa;
3288 unit->mPrevB = xb;
3294 void ring2_aa(BinaryOpUGen *unit, int inNumSamples)
3296 float *out = ZOUT(0);
3297 float *a = ZIN(0);
3298 float *b = ZIN(1);
3300 LOOP1(inNumSamples,
3301 float xa = ZXP(a);
3302 float xb = ZXP(b);
3303 ZXP(out) = xa * xb + xa + xb;
3307 void ring2_ak(BinaryOpUGen *unit, int inNumSamples)
3309 float *out = ZOUT(0);
3310 float *a = ZIN(0);
3311 float xb = unit->mPrevB;
3312 float next_b = ZIN0(1);
3314 if (xb == next_b) {
3315 if (xb == 0.f) {
3316 ZCopy(inNumSamples, out, a);
3317 } else {
3318 LOOP1(inNumSamples,
3319 float xa = ZXP(a);
3320 ZXP(out) = xa * xb + xa + xb;
3323 } else {
3324 float slope = CALCSLOPE(next_b, xb);
3325 LOOP1(inNumSamples,
3326 float xa = ZXP(a);
3327 ZXP(out) = xa * xb + xa + xb;
3328 xb += slope;
3330 unit->mPrevB = xb;
3334 void ring2_ka(BinaryOpUGen *unit, int inNumSamples)
3336 float *out = ZOUT(0);
3337 float xa = unit->mPrevA;
3338 float *b = ZIN(1);
3339 float next_a = ZIN0(0);
3341 if (xa == next_a) {
3342 if (xa == 0.f) {
3343 ZCopy(inNumSamples, out, b);
3344 } else {
3345 LOOP1(inNumSamples,
3346 float xb = ZXP(b);
3347 ZXP(out) = xa * xb + xa + xb;
3350 } else {
3351 float slope = CALCSLOPE(next_a, xa);
3352 LOOP1(inNumSamples,
3353 float xb = ZXP(b);
3354 ZXP(out) = xa * xb + xa + xb;
3355 xa += slope;
3357 unit->mPrevA = xa;
3361 void ring2_ia(BinaryOpUGen *unit, int inNumSamples)
3363 float *out = ZOUT(0);
3364 float xa = ZIN0(0);
3365 float *b = ZIN(1);
3367 LOOP1(inNumSamples,
3368 float xb = ZXP(b);
3369 ZXP(out) = xa * xb + xa + xb;
3371 unit->mPrevA = xa;
3375 void ring2_ai(BinaryOpUGen *unit, int inNumSamples)
3377 float *out = ZOUT(0);
3378 float *a = ZIN(0);
3379 float xb = ZIN0(1);
3381 LOOP1(inNumSamples,
3382 float xa = ZXP(a);
3383 ZXP(out) = xa * xb + xa + xb;
3385 unit->mPrevB = xb;
3391 void ring3_aa(BinaryOpUGen *unit, int inNumSamples)
3393 float *out = ZOUT(0);
3394 float *a = ZIN(0);
3395 float *b = ZIN(1);
3397 LOOP1(inNumSamples,
3398 float xa = ZXP(a);
3399 float xb = ZXP(b);
3400 ZXP(out) = xa * xa * xb;
3404 void ring3_ak(BinaryOpUGen *unit, int inNumSamples)
3406 float *out = ZOUT(0);
3407 float *a = ZIN(0);
3408 float xb = unit->mPrevB;
3409 float next_b = ZIN0(1);
3411 if (xb == next_b) {
3412 if (xb == 0.f) {
3413 ZClear(inNumSamples, out);
3414 } else if (xb == 1.f) {
3415 LOOP1(inNumSamples,
3416 float xa = ZXP(a);
3417 ZXP(out) = xa * xa;
3419 } else {
3420 LOOP1(inNumSamples,
3421 float xa = ZXP(a);
3422 ZXP(out) = xa * xa * xb;
3425 } else {
3426 float slope = CALCSLOPE(next_b, xb);
3427 LOOP1(inNumSamples,
3428 float xa = ZXP(a);
3429 ZXP(out) = xa * xa * xb;
3430 xb += slope;
3432 unit->mPrevB = xb;
3436 void ring3_ka(BinaryOpUGen *unit, int inNumSamples)
3438 float *out = ZOUT(0);
3439 float xa = unit->mPrevA;
3440 float *b = ZIN(1);
3441 float next_a = ZIN0(0);
3443 if (xa == next_a) {
3444 if (xa == 0.f) {
3445 ZClear(inNumSamples, out);
3446 } else if (xa == 1.f) {
3447 ZCopy(inNumSamples, out, b);
3448 } else {
3449 LOOP1(inNumSamples,
3450 float xb = ZXP(b);
3451 ZXP(out) = xa * xa * xb;
3454 } else {
3455 float slope = CALCSLOPE(next_a, xa);
3456 LOOP1(inNumSamples,
3457 float xb = ZXP(b);
3458 ZXP(out) = xa * xa * xb;
3459 xa += slope;
3461 unit->mPrevA = xa;
3465 void ring3_ia(BinaryOpUGen *unit, int inNumSamples)
3467 float *out = ZOUT(0);
3468 float xa = ZIN0(0);
3469 float *b = ZIN(1);
3471 LOOP1(inNumSamples,
3472 float xb = ZXP(b);
3473 ZXP(out) = xa * xa * xb;
3475 unit->mPrevA = xa;
3479 void ring3_ai(BinaryOpUGen *unit, int inNumSamples)
3481 float *out = ZOUT(0);
3482 float *a = ZIN(0);
3483 float xb = ZIN0(1);
3485 LOOP1(inNumSamples,
3486 float xa = ZXP(a);
3487 ZXP(out) = xa * xa * xb;
3489 unit->mPrevB = xb;
3494 void ring4_aa(BinaryOpUGen *unit, int inNumSamples)
3496 float *out = ZOUT(0);
3497 float *a = ZIN(0);
3498 float *b = ZIN(1);
3500 LOOP1(inNumSamples,
3501 float xa = ZXP(a);
3502 float xb = ZXP(b);
3503 ZXP(out) = xa * xa * xb - xa * xb * xb;
3507 void ring4_ak(BinaryOpUGen *unit, int inNumSamples)
3509 float *out = ZOUT(0);
3510 float *a = ZIN(0);
3511 float xb = unit->mPrevB;
3512 float next_b = ZIN0(1);
3514 if (xb == next_b) {
3515 if (xb == 0.f) {
3516 ZClear(inNumSamples, out);
3517 } else if (xb == 1.f) {
3518 LOOP1(inNumSamples,
3519 float xa = ZXP(a);
3520 ZXP(out) = xa * xa - xa;
3522 } else {
3523 LOOP1(inNumSamples,
3524 float xa = ZXP(a);
3525 ZXP(out) = xa * xa * xb - xa * xb * xb;
3528 } else {
3529 float slope = CALCSLOPE(next_b, xb);
3530 LOOP1(inNumSamples,
3531 float xa = ZXP(a);
3532 ZXP(out) = xa * xa * xb - xa * xb * xb;
3533 xb += slope;
3535 unit->mPrevB = xb;
3539 void ring4_ka(BinaryOpUGen *unit, int inNumSamples)
3541 float *out = ZOUT(0);
3542 float xa = unit->mPrevA;
3543 float *b = ZIN(1);
3544 float next_a = ZIN0(0);
3546 if (xa == next_a) {
3547 if (xa == 0.f) {
3548 ZClear(inNumSamples, out);
3549 } else if (xa == 1.f) {
3550 LOOP1(inNumSamples,
3551 float xb = ZXP(b);
3552 ZXP(out) = xb - xb * xb;
3554 } else {
3555 LOOP1(inNumSamples,
3556 float xb = ZXP(b);
3557 ZXP(out) = xa * xa * xb - xa * xb * xb;
3560 } else {
3561 float slope = CALCSLOPE(next_a, xa);
3562 LOOP1(inNumSamples,
3563 float xb = ZXP(b);
3564 ZXP(out) = xa * xa * xb - xa * xb * xb;
3565 xa += slope;
3567 unit->mPrevA = xa;
3571 void ring4_ia(BinaryOpUGen *unit, int inNumSamples)
3573 float *out = ZOUT(0);
3574 float xa = ZIN0(0);
3575 float *b = ZIN(1);
3577 LOOP1(inNumSamples,
3578 float xb = ZXP(b);
3579 ZXP(out) = xa * xa * xb - xa * xb * xb;
3581 unit->mPrevA = xa;
3585 void ring4_ai(BinaryOpUGen *unit, int inNumSamples)
3587 float *out = ZOUT(0);
3588 float *a = ZIN(0);
3589 float xb = ZIN0(1);
3591 LOOP1(inNumSamples,
3592 float xa = ZXP(a);
3593 ZXP(out) = xa * xa * xb - xa * xb * xb;
3595 unit->mPrevB = xb;
3600 void thresh_aa(BinaryOpUGen *unit, int inNumSamples)
3602 float *out = ZOUT(0);
3603 float *a = ZIN(0);
3604 float *b = ZIN(1);
3606 LOOP1(inNumSamples,
3607 float xa = ZXP(a);
3608 float xb = ZXP(b);
3609 ZXP(out) = xa < xb ? 0.f : xa;
3613 void thresh_ak(BinaryOpUGen *unit, int inNumSamples)
3615 float *out = ZOUT(0);
3616 float *a = ZIN(0);
3617 float xb = unit->mPrevB;
3618 float next_b = ZIN0(1);
3620 if (xb == next_b) {
3621 LOOP1(inNumSamples,
3622 float xa = ZXP(a);
3623 ZXP(out) = xa < xb ? 0.f : xa;
3625 } else {
3626 float slope = CALCSLOPE(next_b, xb);
3627 LOOP1(inNumSamples,
3628 float xa = ZXP(a);
3629 ZXP(out) = xa < xb ? 0.f : xa;
3630 xb += slope;
3632 unit->mPrevB = xb;
3636 void thresh_ka(BinaryOpUGen *unit, int inNumSamples)
3638 float *out = ZOUT(0);
3639 float xa = unit->mPrevA;
3640 float *b = ZIN(1);
3641 float next_a = ZIN0(0);
3643 if (xa == next_a) {
3644 LOOP1(inNumSamples,
3645 float xb = ZXP(b);
3646 ZXP(out) = xa < xb ? 0.f : xa;
3648 } else {
3649 float slope = CALCSLOPE(next_a, xa);
3650 LOOP1(inNumSamples,
3651 float xb = ZXP(b);
3652 ZXP(out) = xa < xb ? 0.f : xa;
3653 xa += slope;
3655 unit->mPrevA = xa;
3659 void thresh_ia(BinaryOpUGen *unit, int inNumSamples)
3661 float *out = ZOUT(0);
3662 float xa = ZIN0(0);
3663 float *b = ZIN(1);
3665 LOOP1(inNumSamples,
3666 float xb = ZXP(b);
3667 ZXP(out) = xa < xb ? 0.f : xa;
3669 unit->mPrevA = xa;
3673 void thresh_ai(BinaryOpUGen *unit, int inNumSamples)
3675 float *out = ZOUT(0);
3676 float *a = ZIN(0);
3677 float xb = ZIN0(1);
3679 LOOP1(inNumSamples,
3680 float xa = ZXP(a);
3681 ZXP(out) = xa < xb ? 0.f : xa;
3683 unit->mPrevB = xb;
3688 void clip2_aa(BinaryOpUGen *unit, int inNumSamples)
3690 float *out = ZOUT(0);
3691 float *a = ZIN(0);
3692 float *b = ZIN(1);
3694 LOOP1(inNumSamples,
3695 float xa = ZXP(a);
3696 float xb = ZXP(b);
3697 ZXP(out) = xa > xb ? xb : (xa < -xb ? -xb : xa);
3701 void clip2_ak(BinaryOpUGen *unit, int inNumSamples)
3703 float *out = ZOUT(0);
3704 float *a = ZIN(0);
3705 float xb = unit->mPrevB;
3706 float next_b = ZIN0(1);
3708 if (xb == next_b) {
3709 LOOP1(inNumSamples,
3710 float xa = ZXP(a);
3711 ZXP(out) = xa > xb ? xb : (xa < -xb ? -xb : xa);
3713 } else {
3714 float slope = CALCSLOPE(next_b, xb);
3715 LOOP1(inNumSamples,
3716 float xa = ZXP(a);
3717 ZXP(out) = xa > xb ? xb : (xa < -xb ? -xb : xa);
3718 xb += slope;
3720 unit->mPrevB = xb;
3724 void clip2_ka(BinaryOpUGen *unit, int inNumSamples)
3726 float *out = ZOUT(0);
3727 float xa = unit->mPrevA;
3728 float *b = ZIN(1);
3729 float next_a = ZIN0(0);
3731 if (xa == next_a) {
3732 LOOP1(inNumSamples,
3733 float xb = ZXP(b);
3734 ZXP(out) = xa > xb ? xb : (xa < -xb ? -xb : xa);
3736 } else {
3737 float slope = CALCSLOPE(next_a, xa);
3738 LOOP1(inNumSamples,
3739 float xb = ZXP(b);
3740 ZXP(out) = xa > xb ? xb : (xa < -xb ? -xb : xa);
3741 xa += slope;
3743 unit->mPrevA = xa;
3747 void clip2_ia(BinaryOpUGen *unit, int inNumSamples)
3749 float *out = ZOUT(0);
3750 float xa = ZIN0(0);
3751 float *b = ZIN(1);
3753 LOOP1(inNumSamples,
3754 float xb = ZXP(b);
3755 ZXP(out) = xa > xb ? xb : (xa < -xb ? -xb : xa);
3757 unit->mPrevA = xa;
3761 void clip2_ai(BinaryOpUGen *unit, int inNumSamples)
3763 float *out = ZOUT(0);
3764 float *a = ZIN(0);
3765 float xb = ZIN0(1);
3767 LOOP1(inNumSamples,
3768 float xa = ZXP(a);
3769 ZXP(out) = xa > xb ? xb : (xa < -xb ? -xb : xa);
3771 unit->mPrevB = xb;
3775 #ifdef NOVA_SIMD
3776 NOVA_BINARY_WRAPPER_K(clip2, clip2)
3777 #endif
3780 void excess_aa(BinaryOpUGen *unit, int inNumSamples)
3782 float *out = ZOUT(0);
3783 float *a = ZIN(0);
3784 float *b = ZIN(1);
3786 LOOP1(inNumSamples,
3787 float xa = ZXP(a);
3788 float xb = ZXP(b);
3789 ZXP(out) = xa > xb ? xa-xb : (xa < -xb ? xa+xb : 0.f);
3793 void excess_ak(BinaryOpUGen *unit, int inNumSamples)
3795 float *out = ZOUT(0);
3796 float *a = ZIN(0);
3797 float xb = unit->mPrevB;
3798 float next_b = ZIN0(1);
3800 if (xb == next_b) {
3801 LOOP1(inNumSamples,
3802 float xa = ZXP(a);
3803 ZXP(out) = xa > xb ? xa-xb : (xa < -xb ? xa+xb : 0.f);
3805 } else {
3806 float slope = CALCSLOPE(next_b, xb);
3807 LOOP1(inNumSamples,
3808 float xa = ZXP(a);
3809 ZXP(out) = xa > xb ? xa-xb : (xa < -xb ? xa+xb : 0.f);
3810 xb += slope;
3812 unit->mPrevB = xb;
3816 void excess_ka(BinaryOpUGen *unit, int inNumSamples)
3818 float *out = ZOUT(0);
3819 float xa = unit->mPrevA;
3820 float *b = ZIN(1);
3821 float next_a = ZIN0(0);
3823 if (xa == next_a) {
3824 LOOP1(inNumSamples,
3825 float xb = ZXP(b);
3826 ZXP(out) = xa > xb ? xa-xb : (xa < -xb ? xa+xb : 0.f);
3828 } else {
3829 float slope = CALCSLOPE(next_a, xa);
3830 LOOP1(inNumSamples,
3831 float xb = ZXP(b);
3832 ZXP(out) = xa > xb ? xa-xb : (xa < -xb ? xa+xb : 0.f);
3833 xa += slope;
3835 unit->mPrevA = xa;
3839 void excess_ia(BinaryOpUGen *unit, int inNumSamples)
3841 float *out = ZOUT(0);
3842 float xa = ZIN0(0);
3843 float *b = ZIN(1);
3845 LOOP1(inNumSamples,
3846 float xb = ZXP(b);
3847 ZXP(out) = xa > xb ? xa-xb : (xa < -xb ? xa+xb : 0.f);
3849 unit->mPrevA = xa;
3853 void excess_ai(BinaryOpUGen *unit, int inNumSamples)
3855 float *out = ZOUT(0);
3856 float *a = ZIN(0);
3857 float xb = ZIN0(1);
3859 LOOP1(inNumSamples,
3860 float xa = ZXP(a);
3861 ZXP(out) = xa > xb ? xa-xb : (xa < -xb ? xa+xb : 0.f);
3863 unit->mPrevB = xb;
3868 void lt_aa(BinaryOpUGen *unit, int inNumSamples)
3870 float *out = ZOUT(0);
3871 float *a = ZIN(0);
3872 float *b = ZIN(1);
3874 LOOP1(inNumSamples,
3875 float xa = ZXP(a);
3876 float xb = ZXP(b);
3877 ZXP(out) = xa < xb ? 1.f : 0.f;
3881 #ifdef NOVA_SIMD
3882 NOVA_BINARY_WRAPPER_K(lt, less)
3883 #endif
3886 void lt_ak(BinaryOpUGen *unit, int inNumSamples)
3888 float *out = ZOUT(0);
3889 float *a = ZIN(0);
3890 float xb = unit->mPrevB;
3891 float next_b = ZIN0(1);
3893 if (xb == next_b) {
3894 LOOP1(inNumSamples,
3895 float xa = ZXP(a);
3896 ZXP(out) = xa < xb ? 1.f : 0.f;
3898 } else {
3899 float slope = CALCSLOPE(next_b, xb);
3900 LOOP1(inNumSamples,
3901 float xa = ZXP(a);
3902 ZXP(out) = xa < xb ? 1.f : 0.f;
3903 xb += slope;
3905 unit->mPrevB = xb;
3909 void lt_ka(BinaryOpUGen *unit, int inNumSamples)
3911 float *out = ZOUT(0);
3912 float xa = unit->mPrevA;
3913 float *b = ZIN(1);
3914 float next_a = ZIN0(0);
3916 if (xa == next_a) {
3917 LOOP1(inNumSamples,
3918 float xb = ZXP(b);
3919 ZXP(out) = xa < xb ? 1.f : 0.f;
3921 } else {
3922 float slope = CALCSLOPE(next_a, xa);
3923 LOOP1(inNumSamples,
3924 float xb = ZXP(b);
3925 ZXP(out) = xa < xb ? 1.f : 0.f;
3926 xa += slope;
3928 unit->mPrevA = xa;
3932 void lt_ia(BinaryOpUGen *unit, int inNumSamples)
3934 float *out = ZOUT(0);
3935 float xa = ZIN0(0);
3936 float *b = ZIN(1);
3938 LOOP1(inNumSamples,
3939 float xb = ZXP(b);
3940 ZXP(out) = xa < xb ? 1.f : 0.f;
3942 unit->mPrevA = xa;
3946 void lt_ai(BinaryOpUGen *unit, int inNumSamples)
3948 float *out = ZOUT(0);
3949 float *a = ZIN(0);
3950 float xb = ZIN0(1);
3952 LOOP1(inNumSamples,
3953 float xa = ZXP(a);
3954 ZXP(out) = xa < xb ? 1.f : 0.f;
3956 unit->mPrevB = xb;
3961 void le_aa(BinaryOpUGen *unit, int inNumSamples)
3963 float *out = ZOUT(0);
3964 float *a = ZIN(0);
3965 float *b = ZIN(1);
3967 LOOP1(inNumSamples,
3968 float xa = ZXP(a);
3969 float xb = ZXP(b);
3970 ZXP(out) = xa <= xb ? 1.f : 0.f;
3974 #ifdef NOVA_SIMD
3975 NOVA_BINARY_WRAPPER_K(le, less_equal)
3976 #endif
3978 void le_ak(BinaryOpUGen *unit, int inNumSamples)
3980 float *out = ZOUT(0);
3981 float *a = ZIN(0);
3982 float xb = unit->mPrevB;
3983 float next_b = ZIN0(1);
3985 if (xb == next_b) {
3986 LOOP1(inNumSamples,
3987 float xa = ZXP(a);
3988 ZXP(out) = xa <= xb ? 1.f : 0.f;
3990 } else {
3991 float slope = CALCSLOPE(next_b, xb);
3992 LOOP1(inNumSamples,
3993 float xa = ZXP(a);
3994 ZXP(out) = xa <= xb ? 1.f : 0.f;
3995 xb += slope;
3997 unit->mPrevB = xb;
4001 void le_ka(BinaryOpUGen *unit, int inNumSamples)
4003 float *out = ZOUT(0);
4004 float xa = unit->mPrevA;
4005 float *b = ZIN(1);
4006 float next_a = ZIN0(0);
4008 if (xa == next_a) {
4009 LOOP1(inNumSamples,
4010 float xb = ZXP(b);
4011 ZXP(out) = xa <= xb ? 1.f : 0.f;
4013 } else {
4014 float slope = CALCSLOPE(next_a, xa);
4015 LOOP1(inNumSamples,
4016 float xb = ZXP(b);
4017 ZXP(out) = xa <= xb ? 1.f : 0.f;
4018 xa += slope;
4020 unit->mPrevA = xa;
4024 void le_ia(BinaryOpUGen *unit, int inNumSamples)
4026 float *out = ZOUT(0);
4027 float xa = ZIN0(0);
4028 float *b = ZIN(1);
4030 LOOP1(inNumSamples,
4031 float xb = ZXP(b);
4032 ZXP(out) = xa <= xb ? 1.f : 0.f;
4034 unit->mPrevA = xa;
4038 void le_ai(BinaryOpUGen *unit, int inNumSamples)
4040 float *out = ZOUT(0);
4041 float *a = ZIN(0);
4042 float xb = ZIN0(1);
4044 LOOP1(inNumSamples,
4045 float xa = ZXP(a);
4046 ZXP(out) = xa <= xb ? 1.f : 0.f;
4048 unit->mPrevB = xb;
4053 void gt_aa(BinaryOpUGen *unit, int inNumSamples)
4055 float *out = ZOUT(0);
4056 float *a = ZIN(0);
4057 float *b = ZIN(1);
4059 LOOP1(inNumSamples,
4060 float xa = ZXP(a);
4061 float xb = ZXP(b);
4062 ZXP(out) = xa > xb ? 1.f : 0.f;
4066 #ifdef NOVA_SIMD
4067 NOVA_BINARY_WRAPPER_K(gt, greater)
4068 #endif
4071 void gt_ak(BinaryOpUGen *unit, int inNumSamples)
4073 float *out = ZOUT(0);
4074 float *a = ZIN(0);
4075 float xb = unit->mPrevB;
4076 float next_b = ZIN0(1);
4078 if (xb == next_b) {
4079 LOOP1(inNumSamples,
4080 float xa = ZXP(a);
4081 ZXP(out) = xa > xb ? 1.f : 0.f;
4083 } else {
4084 float slope = CALCSLOPE(next_b, xb);
4085 LOOP1(inNumSamples,
4086 float xa = ZXP(a);
4087 ZXP(out) = xa > xb ? 1.f : 0.f;
4088 xb += slope;
4090 unit->mPrevB = xb;
4094 void gt_ka(BinaryOpUGen *unit, int inNumSamples)
4096 float *out = ZOUT(0);
4097 float xa = unit->mPrevA;
4098 float *b = ZIN(1);
4099 float next_a = ZIN0(0);
4101 if (xa == next_a) {
4102 LOOP1(inNumSamples,
4103 float xb = ZXP(b);
4104 ZXP(out) = xa > xb ? 1.f : 0.f;
4106 } else {
4107 float slope = CALCSLOPE(next_a, xa);
4108 LOOP1(inNumSamples,
4109 float xb = ZXP(b);
4110 ZXP(out) = xa > xb ? 1.f : 0.f;
4111 xa += slope;
4113 unit->mPrevA = xa;
4117 void gt_ia(BinaryOpUGen *unit, int inNumSamples)
4119 float *out = ZOUT(0);
4120 float xa = ZIN0(0);
4121 float *b = ZIN(1);
4123 LOOP1(inNumSamples,
4124 float xb = ZXP(b);
4125 ZXP(out) = xa > xb ? 1.f : 0.f;
4127 unit->mPrevA = xa;
4131 void gt_ai(BinaryOpUGen *unit, int inNumSamples)
4133 float *out = ZOUT(0);
4134 float *a = ZIN(0);
4135 float xb = ZIN0(1);
4137 LOOP1(inNumSamples,
4138 float xa = ZXP(a);
4139 ZXP(out) = xa > xb ? 1.f : 0.f;
4141 unit->mPrevB = xb;
4146 void ge_aa(BinaryOpUGen *unit, int inNumSamples)
4148 float *out = ZOUT(0);
4149 float *a = ZIN(0);
4150 float *b = ZIN(1);
4152 LOOP1(inNumSamples,
4153 float xa = ZXP(a);
4154 float xb = ZXP(b);
4155 ZXP(out) = xa >= xb ? 1.f : 0.f;
4159 #ifdef NOVA_SIMD
4160 NOVA_BINARY_WRAPPER_K(ge, greater_equal)
4161 #endif
4164 void ge_ak(BinaryOpUGen *unit, int inNumSamples)
4166 float *out = ZOUT(0);
4167 float *a = ZIN(0);
4168 float xb = unit->mPrevB;
4169 float next_b = ZIN0(1);
4171 if (xb == next_b) {
4172 LOOP1(inNumSamples,
4173 float xa = ZXP(a);
4174 ZXP(out) = xa >= xb ? 1.f : 0.f;
4176 } else {
4177 float slope = CALCSLOPE(next_b, xb);
4178 LOOP1(inNumSamples,
4179 float xa = ZXP(a);
4180 ZXP(out) = xa >= xb ? 1.f : 0.f;
4181 xb += slope;
4183 unit->mPrevB = xb;
4187 void ge_ka(BinaryOpUGen *unit, int inNumSamples)
4189 float *out = ZOUT(0);
4190 float xa = unit->mPrevA;
4191 float *b = ZIN(1);
4192 float next_a = ZIN0(0);
4194 if (xa == next_a) {
4195 LOOP1(inNumSamples,
4196 float xb = ZXP(b);
4197 ZXP(out) = xa >= xb ? 1.f : 0.f;
4199 } else {
4200 float slope = CALCSLOPE(next_a, xa);
4201 LOOP1(inNumSamples,
4202 float xb = ZXP(b);
4203 ZXP(out) = xa >= xb ? 1.f : 0.f;
4204 xa += slope;
4206 unit->mPrevA = xa;
4210 void ge_ia(BinaryOpUGen *unit, int inNumSamples)
4212 float *out = ZOUT(0);
4213 float xa = ZIN0(0);
4214 float *b = ZIN(1);
4216 LOOP1(inNumSamples,
4217 float xb = ZXP(b);
4218 ZXP(out) = xa >= xb ? 1.f : 0.f;
4220 unit->mPrevA = xa;
4224 void ge_ai(BinaryOpUGen *unit, int inNumSamples)
4226 float *out = ZOUT(0);
4227 float *a = ZIN(0);
4228 float xb = ZIN0(1);
4230 LOOP1(inNumSamples,
4231 float xa = ZXP(a);
4232 ZXP(out) = xa >= xb ? 1.f : 0.f;
4234 unit->mPrevB = xb;
4239 void eq_aa(BinaryOpUGen *unit, int inNumSamples)
4241 float *out = ZOUT(0);
4242 float *a = ZIN(0);
4243 float *b = ZIN(1);
4245 LOOP1(inNumSamples,
4246 float xa = ZXP(a);
4247 float xb = ZXP(b);
4248 ZXP(out) = xa == xb ? 1.f : 0.f;
4252 #ifdef NOVA_SIMD
4253 NOVA_BINARY_WRAPPER_K(eq, equal)
4254 #endif
4256 void eq_ak(BinaryOpUGen *unit, int inNumSamples)
4258 float *out = ZOUT(0);
4259 float *a = ZIN(0);
4260 float xb = unit->mPrevB;
4261 float next_b = ZIN0(1);
4263 if (xb == next_b) {
4264 LOOP1(inNumSamples,
4265 float xa = ZXP(a);
4266 ZXP(out) = xa == xb ? 1.f : 0.f;
4268 } else {
4269 float slope = CALCSLOPE(next_b, xb);
4270 LOOP1(inNumSamples,
4271 float xa = ZXP(a);
4272 ZXP(out) = xa == xb ? 1.f : 0.f;
4273 xb += slope;
4275 unit->mPrevB = xb;
4279 void eq_ka(BinaryOpUGen *unit, int inNumSamples)
4281 float *out = ZOUT(0);
4282 float xa = unit->mPrevA;
4283 float *b = ZIN(1);
4284 float next_a = ZIN0(0);
4286 if (xa == next_a) {
4287 LOOP1(inNumSamples,
4288 float xb = ZXP(b);
4289 ZXP(out) = xa == xb ? 1.f : 0.f;
4291 } else {
4292 float slope = CALCSLOPE(next_a, xa);
4293 LOOP1(inNumSamples,
4294 float xb = ZXP(b);
4295 ZXP(out) = xa == xb ? 1.f : 0.f;
4296 xa += slope;
4298 unit->mPrevA = xa;
4302 void eq_ia(BinaryOpUGen *unit, int inNumSamples)
4304 float *out = ZOUT(0);
4305 float xa = ZIN0(0);
4306 float *b = ZIN(1);
4308 LOOP1(inNumSamples,
4309 float xb = ZXP(b);
4310 ZXP(out) = xa == xb ? 1.f : 0.f;
4312 unit->mPrevA = xa;
4316 void eq_ai(BinaryOpUGen *unit, int inNumSamples)
4318 float *out = ZOUT(0);
4319 float *a = ZIN(0);
4320 float xb = ZIN0(1);
4322 LOOP1(inNumSamples,
4323 float xa = ZXP(a);
4324 ZXP(out) = xa == xb ? 1.f : 0.f;
4326 unit->mPrevB = xb;
4331 void neq_aa(BinaryOpUGen *unit, int inNumSamples)
4333 float *out = ZOUT(0);
4334 float *a = ZIN(0);
4335 float *b = ZIN(1);
4337 LOOP1(inNumSamples,
4338 float xa = ZXP(a);
4339 float xb = ZXP(b);
4340 ZXP(out) = xa != xb ? 1.f : 0.f;
4344 #ifdef NOVA_SIMD
4345 NOVA_BINARY_WRAPPER_K(neq, notequal)
4346 #endif
4349 void neq_ak(BinaryOpUGen *unit, int inNumSamples)
4351 float *out = ZOUT(0);
4352 float *a = ZIN(0);
4353 float xb = unit->mPrevB;
4354 float next_b = ZIN0(1);
4356 if (xb == next_b) {
4357 LOOP1(inNumSamples,
4358 float xa = ZXP(a);
4359 ZXP(out) = xa != xb ? 1.f : 0.f;
4361 } else {
4362 float slope = CALCSLOPE(next_b, xb);
4363 LOOP1(inNumSamples,
4364 float xa = ZXP(a);
4365 ZXP(out) = xa != xb ? 1.f : 0.f;
4366 xb += slope;
4368 unit->mPrevB = xb;
4372 void neq_ka(BinaryOpUGen *unit, int inNumSamples)
4374 float *out = ZOUT(0);
4375 float xa = unit->mPrevA;
4376 float *b = ZIN(1);
4377 float next_a = ZIN0(0);
4379 if (xa == next_a) {
4380 LOOP1(inNumSamples,
4381 float xb = ZXP(b);
4382 ZXP(out) = xa != xb ? 1.f : 0.f;
4384 } else {
4385 float slope = CALCSLOPE(next_a, xa);
4386 LOOP1(inNumSamples,
4387 float xb = ZXP(b);
4388 ZXP(out) = xa != xb ? 1.f : 0.f;
4389 xa += slope;
4391 unit->mPrevA = xa;
4395 void neq_ia(BinaryOpUGen *unit, int inNumSamples)
4397 float *out = ZOUT(0);
4398 float xa = ZIN0(0);
4399 float *b = ZIN(1);
4401 LOOP1(inNumSamples,
4402 float xb = ZXP(b);
4403 ZXP(out) = xa != xb ? 1.f : 0.f;
4405 unit->mPrevA = xa;
4409 void neq_ai(BinaryOpUGen *unit, int inNumSamples)
4411 float *out = ZOUT(0);
4412 float *a = ZIN(0);
4413 float xb = ZIN0(1);
4415 LOOP1(inNumSamples,
4416 float xa = ZXP(a);
4417 ZXP(out) = xa != xb ? 1.f : 0.f;
4419 unit->mPrevB = xb;
4423 void sumsqr_aa(BinaryOpUGen *unit, int inNumSamples)
4425 float *out = ZOUT(0);
4426 float *a = ZIN(0);
4427 float *b = ZIN(1);
4429 LOOP1(inNumSamples,
4430 float xa = ZXP(a);
4431 float xb = ZXP(b);
4432 ZXP(out) = xa * xa + xb * xb;
4436 void sumsqr_ak(BinaryOpUGen *unit, int inNumSamples)
4438 float *out = ZOUT(0);
4439 float *a = ZIN(0);
4440 float xb = unit->mPrevB;
4441 float next_b = ZIN0(1);
4443 if (xb == next_b) {
4444 LOOP1(inNumSamples,
4445 float xa = ZXP(a);
4446 ZXP(out) = xa * xa + xb * xb;
4448 } else {
4449 float slope = CALCSLOPE(next_b, xb);
4450 LOOP1(inNumSamples,
4451 float xa = ZXP(a);
4452 ZXP(out) = xa * xa + xb * xb;
4453 xb += slope;
4455 unit->mPrevB = xb;
4459 void sumsqr_ka(BinaryOpUGen *unit, int inNumSamples)
4461 float *out = ZOUT(0);
4462 float xa = unit->mPrevA;
4463 float *b = ZIN(1);
4464 float next_a = ZIN0(0);
4466 if (xa == next_a) {
4467 LOOP1(inNumSamples,
4468 float xb = ZXP(b);
4469 ZXP(out) = xa * xa + xb * xb;
4471 } else {
4472 float slope = CALCSLOPE(next_a, xa);
4473 LOOP1(inNumSamples,
4474 float xb = ZXP(b);
4475 ZXP(out) = xa * xa + xb * xb;
4476 xa += slope;
4478 unit->mPrevA = xa;
4483 void sumsqr_ia(BinaryOpUGen *unit, int inNumSamples)
4485 float *out = ZOUT(0);
4486 float xa = ZIN0(0);
4487 float *b = ZIN(1);
4489 LOOP1(inNumSamples,
4490 float xb = ZXP(b);
4491 ZXP(out) = xa * xa + xb * xb;
4493 unit->mPrevA = xa;
4497 void sumsqr_ai(BinaryOpUGen *unit, int inNumSamples)
4499 float *out = ZOUT(0);
4500 float *a = ZIN(0);
4501 float xb = ZIN0(1);
4503 LOOP1(inNumSamples,
4504 float xa = ZXP(a);
4505 ZXP(out) = xa * xa + xb * xb;
4507 unit->mPrevB = xb;
4512 void difsqr_aa(BinaryOpUGen *unit, int inNumSamples)
4514 float *out = ZOUT(0);
4515 float *a = ZIN(0);
4516 float *b = ZIN(1);
4518 LOOP1(inNumSamples,
4519 float xa = ZXP(a);
4520 float xb = ZXP(b);
4521 ZXP(out) = xa * xa - xb * xb;
4525 void difsqr_ak(BinaryOpUGen *unit, int inNumSamples)
4527 float *out = ZOUT(0);
4528 float *a = ZIN(0);
4529 float xb = unit->mPrevB;
4530 float next_b = ZIN0(1);
4532 if (xb == next_b) {
4533 LOOP1(inNumSamples,
4534 float xa = ZXP(a);
4535 ZXP(out) = xa * xa - xb * xb;
4537 } else {
4538 float slope = CALCSLOPE(next_b, xb);
4539 LOOP1(inNumSamples,
4540 float xa = ZXP(a);
4541 ZXP(out) = xa * xa - xb * xb;
4542 xb += slope;
4544 unit->mPrevB = xb;
4548 void difsqr_ka(BinaryOpUGen *unit, int inNumSamples)
4550 float *out = ZOUT(0);
4551 float xa = unit->mPrevA;
4552 float *b = ZIN(1);
4553 float next_a = ZIN0(0);
4555 if (xa == next_a) {
4556 LOOP1(inNumSamples,
4557 float xb = ZXP(b);
4558 ZXP(out) = xa * xa - xb * xb;
4560 } else {
4561 float slope = CALCSLOPE(next_a, xa);
4562 LOOP1(inNumSamples,
4563 float xb = ZXP(b);
4564 ZXP(out) = xa * xa - xb * xb;
4565 xa += slope;
4567 unit->mPrevA = xa;
4571 void difsqr_ia(BinaryOpUGen *unit, int inNumSamples)
4573 float *out = ZOUT(0);
4574 float xa = ZIN0(0);
4575 float *b = ZIN(1);
4577 LOOP1(inNumSamples,
4578 float xb = ZXP(b);
4579 ZXP(out) = xa * xa - xb * xb;
4581 unit->mPrevA = xa;
4585 void difsqr_ai(BinaryOpUGen *unit, int inNumSamples)
4587 float *out = ZOUT(0);
4588 float *a = ZIN(0);
4589 float xb = ZIN0(1);
4591 LOOP1(inNumSamples,
4592 float xa = ZXP(a);
4593 ZXP(out) = xa * xa - xb * xb;
4595 unit->mPrevB = xb;
4599 void sqrsum_aa(BinaryOpUGen *unit, int inNumSamples)
4601 float *out = ZOUT(0);
4602 float *a = ZIN(0);
4603 float *b = ZIN(1);
4605 LOOP1(inNumSamples,
4606 float sum = ZXP(a) + ZXP(b);
4607 ZXP(out) = sum * sum;
4611 void sqrsum_ak(BinaryOpUGen *unit, int inNumSamples)
4613 float *out = ZOUT(0);
4614 float *a = ZIN(0);
4615 float xb = unit->mPrevB;
4616 float next_b = ZIN0(1);
4618 if (xb == next_b) {
4619 LOOP1(inNumSamples,
4620 float xa = ZXP(a);
4621 float sum = xa + xb;
4622 ZXP(out) = sum * sum;
4624 } else {
4625 float slope = CALCSLOPE(next_b, xb);
4626 LOOP1(inNumSamples,
4627 float xa = ZXP(a);
4628 float sum = xa + xb;
4629 ZXP(out) = sum * sum;
4630 xb += slope;
4632 unit->mPrevB = xb;
4636 void sqrsum_ka(BinaryOpUGen *unit, int inNumSamples)
4638 float *out = ZOUT(0);
4639 float xa = unit->mPrevA;
4640 float *b = ZIN(1);
4641 float next_a = ZIN0(0);
4643 if (xa == next_a) {
4644 LOOP1(inNumSamples,
4645 float xb = ZXP(b);
4646 float sum = xa + xb;
4647 ZXP(out) = sum * sum;
4649 } else {
4650 float slope = CALCSLOPE(next_a, xa);
4651 LOOP1(inNumSamples,
4652 float xb = ZXP(b);
4653 float sum = xa + xb;
4654 ZXP(out) = sum * sum;
4655 xa += slope;
4657 unit->mPrevA = xa;
4661 void sqrsum_ia(BinaryOpUGen *unit, int inNumSamples)
4663 float *out = ZOUT(0);
4664 float xa = ZIN0(0);
4665 float *b = ZIN(1);
4667 LOOP1(inNumSamples,
4668 float xb = ZXP(b);
4669 float sum = xa + xb;
4670 ZXP(out) = sum * sum;
4672 unit->mPrevA = xa;
4676 void sqrsum_ai(BinaryOpUGen *unit, int inNumSamples)
4678 float *out = ZOUT(0);
4679 float *a = ZIN(0);
4680 float xb = ZIN0(1);
4682 LOOP1(inNumSamples,
4683 float xa = ZXP(a);
4684 float sum = xa + xb;
4685 ZXP(out) = sum * sum;
4687 unit->mPrevB = xb;
4691 void sqrdif_aa(BinaryOpUGen *unit, int inNumSamples)
4693 float *out = ZOUT(0);
4694 float *a = ZIN(0);
4695 float *b = ZIN(1);
4697 LOOP1(inNumSamples,
4698 float dif = ZXP(a) - ZXP(b);
4699 ZXP(out) = dif * dif;
4703 void sqrdif_ak(BinaryOpUGen *unit, int inNumSamples)
4705 float *out = ZOUT(0);
4706 float *a = ZIN(0);
4707 float xb = unit->mPrevB;
4708 float next_b = ZIN0(1);
4710 if (xb == next_b) {
4711 LOOP1(inNumSamples,
4712 float xa = ZXP(a);
4713 float dif = xa - xb;
4714 ZXP(out) = dif * dif;
4716 } else {
4717 float slope = CALCSLOPE(next_b, xb);
4718 LOOP1(inNumSamples,
4719 float xa = ZXP(a);
4720 float dif = xa - xb;
4721 ZXP(out) = dif * dif;
4722 xb += slope;
4724 unit->mPrevB = xb;
4728 void sqrdif_ka(BinaryOpUGen *unit, int inNumSamples)
4730 float *out = ZOUT(0);
4731 float xa = unit->mPrevA;
4732 float *b = ZIN(1);
4733 float next_a = ZIN0(0);
4735 if (xa == next_a) {
4736 LOOP1(inNumSamples,
4737 float xb = ZXP(b);
4738 float dif = xa - xb;
4739 ZXP(out) = dif * dif;
4741 } else {
4742 float slope = CALCSLOPE(next_a, xa);
4743 LOOP1(inNumSamples,
4744 float xb = ZXP(b);
4745 float dif = xa - xb;
4746 ZXP(out) = dif * dif;
4747 xa += slope;
4749 unit->mPrevA = xa;
4754 void sqrdif_ia(BinaryOpUGen *unit, int inNumSamples)
4756 float *out = ZOUT(0);
4757 float xa = ZIN0(0);
4758 float *b = ZIN(1);
4760 LOOP1(inNumSamples,
4761 float xb = ZXP(b);
4762 float dif = xa - xb;
4763 ZXP(out) = dif * dif;
4765 unit->mPrevA = xa;
4769 void sqrdif_ai(BinaryOpUGen *unit, int inNumSamples)
4771 float *out = ZOUT(0);
4772 float *a = ZIN(0);
4773 float xb = ZIN0(1);
4775 LOOP1(inNumSamples,
4776 float xa = ZXP(a);
4777 float dif = xa - xb;
4778 ZXP(out) = dif * dif;
4780 unit->mPrevB = xb;
4784 void absdif_aa(BinaryOpUGen *unit, int inNumSamples)
4786 float *out = ZOUT(0);
4787 float *a = ZIN(0);
4788 float *b = ZIN(1);
4790 LOOP1(inNumSamples,
4791 float dif = ZXP(a) - ZXP(b);
4792 ZXP(out) = fabs(dif);
4796 void absdif_ak(BinaryOpUGen *unit, int inNumSamples)
4798 float *out = ZOUT(0);
4799 float *a = ZIN(0);
4800 float xb = unit->mPrevB;
4801 float next_b = ZIN0(1);
4803 if (xb == next_b) {
4804 LOOP1(inNumSamples,
4805 float xa = ZXP(a);
4806 float dif = xa - xb;
4807 ZXP(out) = fabs(dif);
4809 } else {
4810 float slope = CALCSLOPE(next_b, xb);
4811 LOOP1(inNumSamples,
4812 float xa = ZXP(a);
4813 float dif = xa - xb;
4814 ZXP(out) = fabs(dif);
4815 xb += slope;
4817 unit->mPrevB = xb;
4821 void absdif_ka(BinaryOpUGen *unit, int inNumSamples)
4823 float *out = ZOUT(0);
4824 float xa = unit->mPrevA;
4825 float *b = ZIN(1);
4826 float next_a = ZIN0(0);
4828 if (xa == next_a) {
4829 LOOP1(inNumSamples,
4830 float xb = ZXP(b);
4831 float dif = xa - xb;
4832 ZXP(out) = fabs(dif);
4834 } else {
4835 float slope = CALCSLOPE(next_a, xa);
4836 LOOP1(inNumSamples,
4837 float xb = ZXP(b);
4838 float dif = xa - xb;
4839 ZXP(out) = fabs(dif);
4840 xa += slope;
4842 unit->mPrevA = xa;
4846 void absdif_ia(BinaryOpUGen *unit, int inNumSamples)
4848 float *out = ZOUT(0);
4849 float xa = ZIN0(0);
4850 float *b = ZIN(1);
4852 LOOP1(inNumSamples,
4853 float xb = ZXP(b);
4854 float dif = xa - xb;
4855 ZXP(out) = fabs(dif);
4857 unit->mPrevA = xa;
4861 void absdif_ai(BinaryOpUGen *unit, int inNumSamples)
4863 float *out = ZOUT(0);
4864 float *a = ZIN(0);
4865 float xb = ZIN0(1);
4867 LOOP1(inNumSamples,
4868 float xa = ZXP(a);
4869 float dif = xa - xb;
4870 ZXP(out) = fabs(dif);
4872 unit->mPrevB = xb;
4876 void round_aa(BinaryOpUGen *unit, int inNumSamples)
4878 float *out = ZOUT(0);
4879 float *a = ZIN(0);
4880 float *b = ZIN(1);
4882 LOOP1(inNumSamples,
4883 float xa = ZXP(a);
4884 float xb = ZXP(b);
4885 ZXP(out) = sc_round(xa, xb);
4889 void round_ak(BinaryOpUGen *unit, int inNumSamples)
4891 float *out = ZOUT(0);
4892 float *a = ZIN(0);
4893 float xb = unit->mPrevB;
4894 float next_b = ZIN0(1);
4896 if (xb == next_b) {
4897 LOOP1(inNumSamples,
4898 float xa = ZXP(a);
4899 ZXP(out) = sc_round(xa, xb);
4901 } else {
4902 float slope = CALCSLOPE(next_b, xb);
4903 LOOP1(inNumSamples,
4904 float xa = ZXP(a);
4905 ZXP(out) = sc_round(xa, xb);
4906 xb += slope;
4908 unit->mPrevB = xb;
4912 void round_ka(BinaryOpUGen *unit, int inNumSamples)
4914 float *out = ZOUT(0);
4915 float xa = unit->mPrevA;
4916 float *b = ZIN(1);
4917 float next_a = ZIN0(0);
4919 if (xa == next_a) {
4920 LOOP1(inNumSamples,
4921 float xb = ZXP(b);
4922 ZXP(out) = sc_round(xa, xb);
4924 } else {
4925 float slope = CALCSLOPE(next_a, xa);
4926 LOOP1(inNumSamples,
4927 float xb = ZXP(b);
4928 ZXP(out) = sc_round(xa, xb);
4929 xa += slope;
4931 unit->mPrevA = xa;
4936 void round_ia(BinaryOpUGen *unit, int inNumSamples)
4938 float *out = ZOUT(0);
4939 float xa = ZIN0(0);
4940 float *b = ZIN(1);
4942 LOOP1(inNumSamples,
4943 float xb = ZXP(b);
4944 ZXP(out) = sc_round(xa, xb);
4946 unit->mPrevA = xa;
4950 void round_ai(BinaryOpUGen *unit, int inNumSamples)
4952 float *out = ZOUT(0);
4953 float *a = ZIN(0);
4954 float xb = ZIN0(1);
4956 LOOP1(inNumSamples,
4957 float xa = ZXP(a);
4958 ZXP(out) = sc_round(xa, xb);
4960 unit->mPrevB = xb;
4966 void roundUp_aa(BinaryOpUGen *unit, int inNumSamples)
4968 float *out = ZOUT(0);
4969 float *a = ZIN(0);
4970 float *b = ZIN(1);
4972 LOOP1(inNumSamples,
4973 float xa = ZXP(a);
4974 float xb = ZXP(b);
4975 ZXP(out) = sc_roundUp(xa, xb);
4979 void roundUp_ak(BinaryOpUGen *unit, int inNumSamples)
4981 float *out = ZOUT(0);
4982 float *a = ZIN(0);
4983 float xb = unit->mPrevB;
4984 float next_b = ZIN0(1);
4986 if (xb == next_b) {
4987 LOOP1(inNumSamples,
4988 float xa = ZXP(a);
4989 ZXP(out) = sc_roundUp(xa, xb);
4991 } else {
4992 float slope = CALCSLOPE(next_b, xb);
4993 LOOP1(inNumSamples,
4994 float xa = ZXP(a);
4995 ZXP(out) = sc_roundUp(xa, xb);
4996 xb += slope;
4998 unit->mPrevB = xb;
5002 void roundUp_ka(BinaryOpUGen *unit, int inNumSamples)
5004 float *out = ZOUT(0);
5005 float xa = unit->mPrevA;
5006 float *b = ZIN(1);
5007 float next_a = ZIN0(0);
5009 if (xa == next_a) {
5010 LOOP1(inNumSamples,
5011 float xb = ZXP(b);
5012 ZXP(out) = sc_roundUp(xa, xb);
5014 } else {
5015 float slope = CALCSLOPE(next_a, xa);
5016 LOOP1(inNumSamples,
5017 float xb = ZXP(b);
5018 ZXP(out) = sc_roundUp(xa, xb);
5019 xa += slope;
5021 unit->mPrevA = xa;
5026 void roundUp_ia(BinaryOpUGen *unit, int inNumSamples)
5028 float *out = ZOUT(0);
5029 float xa = ZIN0(0);
5030 float *b = ZIN(1);
5032 LOOP1(inNumSamples,
5033 float xb = ZXP(b);
5034 ZXP(out) = sc_roundUp(xa, xb);
5036 unit->mPrevA = xa;
5040 void roundUp_ai(BinaryOpUGen *unit, int inNumSamples)
5042 float *out = ZOUT(0);
5043 float *a = ZIN(0);
5044 float xb = ZIN0(1);
5046 LOOP1(inNumSamples,
5047 float xa = ZXP(a);
5048 ZXP(out) = sc_roundUp(xa, xb);
5050 unit->mPrevB = xb;
5055 void trunc_aa(BinaryOpUGen *unit, int inNumSamples)
5057 float *out = ZOUT(0);
5058 float *a = ZIN(0);
5059 float *b = ZIN(1);
5061 LOOP1(inNumSamples,
5062 float xa = ZXP(a);
5063 float xb = ZXP(b);
5064 ZXP(out) = sc_trunc(xa, xb);
5068 void trunc_ak(BinaryOpUGen *unit, int inNumSamples)
5070 float *out = ZOUT(0);
5071 float *a = ZIN(0);
5072 float xb = unit->mPrevB;
5073 float next_b = ZIN0(1);
5075 if (xb == next_b) {
5076 LOOP1(inNumSamples,
5077 float xa = ZXP(a);
5078 ZXP(out) = sc_trunc(xa, xb);
5080 } else {
5081 float slope = CALCSLOPE(next_b, xb);
5082 LOOP1(inNumSamples,
5083 float xa = ZXP(a);
5084 ZXP(out) = sc_trunc(xa, xb);
5085 xb += slope;
5087 unit->mPrevB = xb;
5091 void trunc_ka(BinaryOpUGen *unit, int inNumSamples)
5093 float *out = ZOUT(0);
5094 float xa = unit->mPrevA;
5095 float *b = ZIN(1);
5096 float next_a = ZIN0(0);
5098 if (xa == next_a) {
5099 LOOP1(inNumSamples,
5100 float xb = ZXP(b);
5101 ZXP(out) = sc_trunc(xa, xb);
5103 } else {
5104 float slope = CALCSLOPE(next_a, xa);
5105 LOOP1(inNumSamples,
5106 float xb = ZXP(b);
5107 ZXP(out) = sc_trunc(xa, xb);
5108 xa += slope;
5110 unit->mPrevA = xa;
5114 void trunc_ia(BinaryOpUGen *unit, int inNumSamples)
5116 float *out = ZOUT(0);
5117 float xa = ZIN0(0);
5118 float *b = ZIN(1);
5120 LOOP1(inNumSamples,
5121 float xb = ZXP(b);
5122 ZXP(out) = sc_trunc(xa, xb);
5124 unit->mPrevA = xa;
5128 void trunc_ai(BinaryOpUGen *unit, int inNumSamples)
5130 float *out = ZOUT(0);
5131 float *a = ZIN(0);
5132 float xb = ZIN0(1);
5134 LOOP1(inNumSamples,
5135 float xa = ZXP(a);
5136 ZXP(out) = sc_trunc(xa, xb);
5138 unit->mPrevB = xb;
5143 void fold2_aa(BinaryOpUGen *unit, int inNumSamples)
5145 float *out = ZOUT(0);
5146 float *a = ZIN(0);
5147 float *b = ZIN(1);
5149 LOOP1(inNumSamples,
5150 float xa = ZXP(a);
5151 float xb = ZXP(b);
5152 ZXP(out) = sc_fold(xa, -xb, xb);
5156 void fold2_ak(BinaryOpUGen *unit, int inNumSamples)
5158 float *out = ZOUT(0);
5159 float *a = ZIN(0);
5160 float xb = unit->mPrevB;
5161 float next_b = ZIN0(1);
5163 if (xb == next_b) {
5164 LOOP1(inNumSamples,
5165 float xa = ZXP(a);
5166 ZXP(out) = sc_fold(xa, -xb, xb);
5168 } else {
5169 float slope = CALCSLOPE(next_b, xb);
5170 LOOP1(inNumSamples,
5171 float xa = ZXP(a);
5172 ZXP(out) = sc_fold(xa, -xb, xb);
5173 xb += slope;
5175 unit->mPrevB = xb;
5179 void fold2_ka(BinaryOpUGen *unit, int inNumSamples)
5181 float *out = ZOUT(0);
5182 float xa = unit->mPrevA;
5183 float *b = ZIN(1);
5184 float next_a = ZIN0(0);
5186 if (xa == next_a) {
5187 LOOP1(inNumSamples,
5188 float xb = ZXP(b);
5189 ZXP(out) = sc_fold(xa, -xb, xb);
5191 } else {
5192 float slope = CALCSLOPE(next_a, xa);
5193 LOOP1(inNumSamples,
5194 float xb = ZXP(b);
5195 ZXP(out) = sc_fold(xa, -xb, xb);
5196 xa += slope;
5198 unit->mPrevA = xa;
5202 void fold2_ia(BinaryOpUGen *unit, int inNumSamples)
5204 float *out = ZOUT(0);
5205 float xa = ZIN0(0);
5206 float *b = ZIN(1);
5208 LOOP1(inNumSamples,
5209 float xb = ZXP(b);
5210 ZXP(out) = sc_fold(xa, -xb, xb);
5212 unit->mPrevA = xa;
5216 void fold2_ai(BinaryOpUGen *unit, int inNumSamples)
5218 float *out = ZOUT(0);
5219 float *a = ZIN(0);
5220 float xb = ZIN0(1);
5222 LOOP1(inNumSamples,
5223 float xa = ZXP(a);
5224 ZXP(out) = sc_fold(xa, -xb, xb);
5226 unit->mPrevB = xb;
5232 void wrap2_aa(BinaryOpUGen *unit, int inNumSamples)
5234 float *out = ZOUT(0);
5235 float *a = ZIN(0);
5236 float *b = ZIN(1);
5238 LOOP1(inNumSamples,
5239 float xa = ZXP(a);
5240 float xb = ZXP(b);
5241 ZXP(out) = sc_wrap(xa, -xb, xb);
5245 void wrap2_ak(BinaryOpUGen *unit, int inNumSamples)
5247 float *out = ZOUT(0);
5248 float *a = ZIN(0);
5249 float xb = unit->mPrevB;
5250 float next_b = ZIN0(1);
5252 if (xb == next_b) {
5253 LOOP1(inNumSamples,
5254 float xa = ZXP(a);
5255 ZXP(out) = sc_wrap(xa, -xb, xb);
5257 } else {
5258 float slope = CALCSLOPE(next_b, xb);
5259 LOOP1(inNumSamples,
5260 float xa = ZXP(a);
5261 ZXP(out) = sc_wrap(xa, -xb, xb);
5262 xb += slope;
5264 unit->mPrevB = xb;
5268 void wrap2_ka(BinaryOpUGen *unit, int inNumSamples)
5270 float *out = ZOUT(0);
5271 float xa = unit->mPrevA;
5272 float *b = ZIN(1);
5273 float next_a = ZIN0(0);
5275 if (xa == next_a) {
5276 LOOP1(inNumSamples,
5277 float xb = ZXP(b);
5278 ZXP(out) = sc_wrap(xa, -xb, xb);
5280 } else {
5281 float slope = CALCSLOPE(next_a, xa);
5282 LOOP1(inNumSamples,
5283 float xb = ZXP(b);
5284 ZXP(out) = sc_wrap(xa, -xb, xb);
5285 xa += slope;
5287 unit->mPrevA = xa;
5291 void wrap2_ia(BinaryOpUGen *unit, int inNumSamples)
5293 float *out = ZOUT(0);
5294 float xa = ZIN0(0);
5295 float *b = ZIN(1);
5297 LOOP1(inNumSamples,
5298 float xb = ZXP(b);
5299 ZXP(out) = sc_wrap(xa, -xb, xb);
5301 unit->mPrevA = xa;
5305 void wrap2_ai(BinaryOpUGen *unit, int inNumSamples)
5307 float *out = ZOUT(0);
5308 float *a = ZIN(0);
5309 float xb = ZIN0(1);
5311 LOOP1(inNumSamples,
5312 float xa = ZXP(a);
5313 ZXP(out) = sc_wrap(xa, -xb, xb);
5315 unit->mPrevB = xb;
5320 void atan2_aa(BinaryOpUGen *unit, int inNumSamples)
5322 float *out = ZOUT(0);
5323 float *a = ZIN(0);
5324 float *b = ZIN(1);
5326 LOOP1(inNumSamples,
5327 float xa = ZXP(a);
5328 float xb = ZXP(b);
5329 ZXP(out) = atan2(xa, xb);
5333 void atan2_ak(BinaryOpUGen *unit, int inNumSamples)
5335 float *out = ZOUT(0);
5336 float *a = ZIN(0);
5337 float xb = unit->mPrevB;
5338 float next_b = ZIN0(1);
5340 if (xb == next_b) {
5341 LOOP1(inNumSamples,
5342 float xa = ZXP(a);
5343 ZXP(out) = atan2(xa, xb);
5345 } else {
5346 float slope = CALCSLOPE(next_b, xb);
5347 LOOP1(inNumSamples,
5348 float xa = ZXP(a);
5349 ZXP(out) = atan2(xa, xb);
5350 xb += slope;
5352 unit->mPrevB = xb;
5356 void atan2_ka(BinaryOpUGen *unit, int inNumSamples)
5358 float *out = ZOUT(0);
5359 float xa = unit->mPrevA;
5360 float *b = ZIN(1);
5361 float next_a = ZIN0(0);
5363 if (xa == next_a) {
5364 LOOP1(inNumSamples,
5365 float xb = ZXP(b);
5366 ZXP(out) = atan2(xa, xb);
5368 } else {
5369 float slope = CALCSLOPE(next_a, xa);
5370 LOOP1(inNumSamples,
5371 float xb = ZXP(b);
5372 ZXP(out) = atan2(xa, xb);
5373 xa += slope;
5375 unit->mPrevA = xa;
5379 void atan2_ia(BinaryOpUGen *unit, int inNumSamples)
5381 float *out = ZOUT(0);
5382 float xa = ZIN0(0);
5383 float *b = ZIN(1);
5385 LOOP1(inNumSamples,
5386 float xb = ZXP(b);
5387 ZXP(out) = atan2(xa, xb);
5389 unit->mPrevA = xa;
5393 void atan2_ai(BinaryOpUGen *unit, int inNumSamples)
5395 float *out = ZOUT(0);
5396 float *a = ZIN(0);
5397 float xb = ZIN0(1);
5399 LOOP1(inNumSamples,
5400 float xa = ZXP(a);
5401 ZXP(out) = atan2(xa, xb);
5403 unit->mPrevB = xb;
5407 void hypot_aa(BinaryOpUGen *unit, int inNumSamples)
5409 float *out = ZOUT(0);
5410 float *a = ZIN(0);
5411 float *b = ZIN(1);
5413 LOOP1(inNumSamples,
5414 float xa = ZXP(a);
5415 float xb = ZXP(b);
5416 ZXP(out) = hypotf(xa, xb);
5420 void hypot_ak(BinaryOpUGen *unit, int inNumSamples)
5422 float *out = ZOUT(0);
5423 float *a = ZIN(0);
5424 float xb = unit->mPrevB;
5425 float next_b = ZIN0(1);
5427 if (xb == next_b) {
5428 LOOP1(inNumSamples,
5429 float xa = ZXP(a);
5430 ZXP(out) = hypotf(xa, xb);
5432 } else {
5433 float slope = CALCSLOPE(next_b, xb);
5434 LOOP1(inNumSamples,
5435 float xa = ZXP(a);
5436 ZXP(out) = hypotf(xa, xb);
5437 xb += slope;
5439 unit->mPrevB = xb;
5443 void hypot_ka(BinaryOpUGen *unit, int inNumSamples)
5445 float *out = ZOUT(0);
5446 float xa = unit->mPrevA;
5447 float *b = ZIN(1);
5448 float next_a = ZIN0(0);
5450 if (xa == next_a) {
5451 LOOP1(inNumSamples,
5452 float xb = ZXP(b);
5453 ZXP(out) = hypotf(xa, xb);
5455 } else {
5456 float slope = CALCSLOPE(next_a, xa);
5457 LOOP1(inNumSamples,
5458 float xb = ZXP(b);
5459 ZXP(out) = hypotf(xa, xb);
5460 xa += slope;
5462 unit->mPrevA = xa;
5466 void hypot_ia(BinaryOpUGen *unit, int inNumSamples)
5468 float *out = ZOUT(0);
5469 float xa = ZIN0(0);
5470 float *b = ZIN(1);
5472 LOOP1(inNumSamples,
5473 float xb = ZXP(b);
5474 ZXP(out) = hypotf(xa, xb);
5476 unit->mPrevA = xa;
5480 void hypot_ai(BinaryOpUGen *unit, int inNumSamples)
5482 float *out = ZOUT(0);
5483 float *a = ZIN(0);
5484 float xb = ZIN0(1);
5486 LOOP1(inNumSamples,
5487 float xa = ZXP(a);
5488 ZXP(out) = hypotf(xa, xb);
5490 unit->mPrevB = xb;
5495 void hypotx_aa(BinaryOpUGen *unit, int inNumSamples)
5497 float *out = ZOUT(0);
5498 float *a = ZIN(0);
5499 float *b = ZIN(1);
5501 LOOP1(inNumSamples,
5502 float xa = ZXP(a);
5503 float xb = ZXP(b);
5504 ZXP(out) = sc_hypotx(xa, xb);
5508 void hypotx_ak(BinaryOpUGen *unit, int inNumSamples)
5510 float *out = ZOUT(0);
5511 float *a = ZIN(0);
5512 float xb = unit->mPrevB;
5513 float next_b = ZIN0(1);
5515 if (xb == next_b) {
5516 LOOP1(inNumSamples,
5517 float xa = ZXP(a);
5518 ZXP(out) = sc_hypotx(xa, xb);
5520 } else {
5521 float slope = CALCSLOPE(next_b, xb);
5522 LOOP1(inNumSamples,
5523 float xa = ZXP(a);
5524 ZXP(out) = sc_hypotx(xa, xb);
5525 xb += slope;
5527 unit->mPrevB = xb;
5531 void hypotx_ka(BinaryOpUGen *unit, int inNumSamples)
5533 float *out = ZOUT(0);
5534 float xa = unit->mPrevA;
5535 float *b = ZIN(1);
5536 float next_a = ZIN0(0);
5538 if (xa == next_a) {
5539 LOOP1(inNumSamples,
5540 float xb = ZXP(b);
5541 ZXP(out) = sc_hypotx(xa, xb);
5543 } else {
5544 float slope = CALCSLOPE(next_a, xa);
5545 LOOP1(inNumSamples,
5546 float xb = ZXP(b);
5547 ZXP(out) = sc_hypotx(xa, xb);
5548 xa += slope;
5550 unit->mPrevA = xa;
5554 void hypotx_ia(BinaryOpUGen *unit, int inNumSamples)
5556 float *out = ZOUT(0);
5557 float xa = ZIN0(0);
5558 float *b = ZIN(1);
5560 LOOP1(inNumSamples,
5561 float xb = ZXP(b);
5562 ZXP(out) = sc_hypotx(xa, xb);
5564 unit->mPrevA = xa;
5568 void hypotx_ai(BinaryOpUGen *unit, int inNumSamples)
5570 float *out = ZOUT(0);
5571 float *a = ZIN(0);
5572 float xb = ZIN0(1);
5574 LOOP1(inNumSamples,
5575 float xa = ZXP(a);
5576 ZXP(out) = sc_hypotx(xa, xb);
5578 unit->mPrevB = xb;
5581 static BinaryOpFunc ChooseOneSampleFunc(BinaryOpUGen *unit)
5583 BinaryOpFunc func = &zero_1;
5585 switch (unit->mSpecialIndex) {
5586 //case opSilence2 : func = &zero_1; break;
5587 case opAdd : func = &add_1; break;
5588 case opSub : func = &sub_1; break;
5589 case opMul : func = &mul_1; break;
5590 case opFDiv : func = &div_1; break;
5591 case opMod : func = &mod_1; break;
5592 case opEQ : func = &eq_1; break;
5593 case opNE : func = &neq_1; break;
5594 case opLT : func = &lt_1; break;
5595 case opGT : func = &gt_1; break;
5596 case opLE : func = &le_1; break;
5597 case opGE : func = &ge_1; break;
5598 case opMin : func = &min_1; break;
5599 case opMax : func = &max_1; break;
5600 case opBitAnd : func = &and_1; break;
5601 case opBitOr : func = &or_1; break;
5602 case opBitXor : func = &xor_1; break;
5603 case opShiftRight : func = &rightShift_1; break;
5604 case opShiftLeft : func = &leftShift_1; break;
5605 case opRound : func = &round_1; break;
5606 case opRoundUp : func = &roundUp_1; break;
5607 case opTrunc : func = &trunc_1; break;
5608 case opAtan2 : func = &atan2_1; break;
5609 case opHypot : func = &hypot_1; break;
5610 case opHypotx : func = &hypotx_1; break;
5611 case opPow : func = &pow_1; break;
5612 case opRing1 : func = &ring1_1; break;
5613 case opRing2 : func = &ring2_1; break;
5614 case opRing3 : func = &ring3_1; break;
5615 case opRing4 : func = &ring4_1; break;
5616 case opDifSqr : func = &difsqr_1; break;
5617 case opSumSqr : func = &sumsqr_1; break;
5618 case opSqrSum : func = &sqrsum_1; break;
5619 case opSqrDif : func = &sqrdif_1; break;
5620 case opAbsDif : func = &absdif_1; break;
5621 case opThresh : func = &thresh_1; break;
5622 case opAMClip : func = &amclip_1; break;
5623 case opScaleNeg : func = &scaleneg_1; break;
5624 case opClip2 : func = &clip2_1; break;
5625 case opFold2 : func = &fold2_1; break;
5626 case opWrap2 : func = &wrap2_1; break;
5627 case opExcess : func = &excess_1; break;
5628 case opFirstArg : func = &firstarg_1; break;
5629 //case opSecondArg : func = &secondarg_1; break;
5630 default : func = &add_1; break;
5632 return func;
5636 static BinaryOpFunc ChooseDemandFunc(BinaryOpUGen *unit)
5638 BinaryOpFunc func = &zero_1;
5640 switch (unit->mSpecialIndex) {
5641 //case opSilence2 : func = &zero_d; break;
5642 case opAdd : func = &add_d; break;
5643 case opSub : func = &sub_d; break;
5644 case opMul : func = &mul_d; break;
5645 case opFDiv : func = &div_d; break;
5646 case opMod : func = &mod_d; break;
5647 case opEQ : func = &eq_d; break;
5648 case opNE : func = &neq_d; break;
5649 case opLT : func = &lt_d; break;
5650 case opGT : func = &gt_d; break;
5651 case opLE : func = &le_d; break;
5652 case opGE : func = &ge_d; break;
5653 case opMin : func = &min_d; break;
5654 case opMax : func = &max_d; break;
5655 case opBitAnd : func = &and_d; break;
5656 case opBitOr : func = &or_d; break;
5657 case opBitXor : func = &xor_d; break;
5658 case opShiftRight : func = &rightShift_d; break;
5659 case opShiftLeft : func = &leftShift_d; break;
5660 case opRound : func = &round_d; break;
5661 case opRoundUp : func = &roundUp_d; break;
5662 case opTrunc : func = &trunc_d; break;
5663 case opAtan2 : func = &atan2_d; break;
5664 case opHypot : func = &hypot_d; break;
5665 case opHypotx : func = &hypotx_d; break;
5666 case opPow : func = &pow_d; break;
5667 case opRing1 : func = &ring1_d; break;
5668 case opRing2 : func = &ring2_d; break;
5669 case opRing3 : func = &ring3_d; break;
5670 case opRing4 : func = &ring4_d; break;
5671 case opDifSqr : func = &difsqr_d; break;
5672 case opSumSqr : func = &sumsqr_d; break;
5673 case opSqrSum : func = &sqrsum_d; break;
5674 case opSqrDif : func = &sqrdif_d; break;
5675 case opAbsDif : func = &absdif_d; break;
5676 case opThresh : func = &thresh_d; break;
5677 case opAMClip : func = &amclip_d; break;
5678 case opScaleNeg : func = &scaleneg_d; break;
5679 case opClip2 : func = &clip2_d; break;
5680 case opFold2 : func = &fold2_d; break;
5681 case opWrap2 : func = &wrap2_d; break;
5682 case opExcess : func = &excess_d; break;
5683 case opFirstArg : func = &firstarg_d; break;
5684 //case opSecondArg : func = &secondarg_d; break;
5685 default : func = &add_d; break;
5687 return func;
5691 static BinaryOpFunc ChooseNormalFunc(BinaryOpUGen *unit)
5693 BinaryOpFunc func = &zero_1;
5695 int rateA = INRATE(0);
5696 int rateB = INRATE(1);
5698 switch (rateA) {
5699 case calc_FullRate:
5700 switch (rateB) {
5701 case calc_FullRate:
5702 switch (unit->mSpecialIndex) {
5703 //case opSilence2 : func = &zero_aa; break;
5704 case opAdd : func = &add_aa; break;
5705 case opSub : func = &sub_aa; break;
5706 case opMul : func = &mul_aa; break;
5707 case opFDiv : func = &div_aa; break;
5708 case opMod : func = &mod_aa; break;
5709 case opEQ : func = &eq_aa; break;
5710 case opNE : func = &neq_aa; break;
5711 case opLT : func = &lt_aa; break;
5712 case opGT : func = &gt_aa; break;
5713 case opLE : func = &le_aa; break;
5714 case opGE : func = &ge_aa; break;
5715 case opMin : func = &min_aa; break;
5716 case opMax : func = &max_aa; break;
5717 case opBitAnd : func = &and_aa; break;
5718 case opBitOr : func = &or_aa; break;
5719 case opBitXor : func = &xor_aa; break;
5720 case opShiftRight : func = &rightShift_aa; break;
5721 case opShiftLeft : func = &leftShift_aa; break;
5722 case opRound : func = &round_aa; break;
5723 case opRoundUp : func = &roundUp_aa; break;
5724 case opTrunc : func = &trunc_aa; break;
5725 case opAtan2 : func = &atan2_aa; break;
5726 case opHypot : func = &hypot_aa; break;
5727 case opHypotx : func = &hypotx_aa; break;
5728 case opPow : func = &pow_aa; break;
5729 case opRing1 : func = &ring1_aa; break;
5730 case opRing2 : func = &ring2_aa; break;
5731 case opRing3 : func = &ring3_aa; break;
5732 case opRing4 : func = &ring4_aa; break;
5733 case opDifSqr : func = &difsqr_aa; break;
5734 case opSumSqr : func = &sumsqr_aa; break;
5735 case opSqrSum : func = &sqrsum_aa; break;
5736 case opSqrDif : func = &sqrdif_aa; break;
5737 case opAbsDif : func = &absdif_aa; break;
5738 case opThresh : func = &thresh_aa; break;
5739 case opAMClip : func = &amclip_aa; break;
5740 case opScaleNeg : func = &scaleneg_aa; break;
5741 case opClip2 : func = &clip2_aa; break;
5742 case opFold2 : func = &fold2_aa; break;
5743 case opWrap2 : func = &wrap2_aa; break;
5744 case opExcess : func = &excess_aa; break;
5745 case opFirstArg : func = &firstarg_aa; break;
5746 //case opSecondArg : func = &secondarg_aa; break;
5747 default : func = &add_aa; break;
5749 break;
5750 case calc_BufRate :
5751 switch (unit->mSpecialIndex) {
5752 //case opSilence2 : func = &zero_aa; break;
5753 case opAdd : func = &add_ak; break;
5754 case opSub : func = &sub_ak; break;
5755 case opMul : func = &mul_ak; break;
5756 case opFDiv : func = &div_ak; break;
5757 case opMod : func = &mod_ak; break;
5758 case opEQ : func = &eq_ak; break;
5759 case opNE : func = &neq_ak; break;
5760 case opLT : func = &lt_ak; break;
5761 case opGT : func = &gt_ak; break;
5762 case opLE : func = &le_ak; break;
5763 case opGE : func = &ge_ak; break;
5764 case opMin : func = &min_ak; break;
5765 case opMax : func = &max_ak; break;
5766 case opBitAnd : func = &and_ak; break;
5767 case opBitOr : func = &or_ak; break;
5768 case opBitXor : func = &xor_ak; break;
5769 case opShiftRight : func = &rightShift_ak; break;
5770 case opShiftLeft : func = &leftShift_ak; break;
5771 case opRound : func = &round_ak; break;
5772 case opRoundUp : func = &roundUp_ak; break;
5773 case opTrunc : func = &trunc_ak; break;
5774 case opAtan2 : func = &atan2_ak; break;
5775 case opHypot : func = &hypot_ak; break;
5776 case opHypotx : func = &hypotx_ak; break;
5777 case opPow : func = &pow_ak; break;
5778 case opRing1 : func = &ring1_ak; break;
5779 case opRing2 : func = &ring2_ak; break;
5780 case opRing3 : func = &ring3_ak; break;
5781 case opRing4 : func = &ring4_ak; break;
5782 case opDifSqr : func = &difsqr_ak; break;
5783 case opSumSqr : func = &sumsqr_ak; break;
5784 case opSqrSum : func = &sqrsum_ak; break;
5785 case opSqrDif : func = &sqrdif_ak; break;
5786 case opAbsDif : func = &absdif_ak; break;
5787 case opThresh : func = &thresh_ak; break;
5788 case opAMClip : func = &amclip_ak; break;
5789 case opScaleNeg : func = &scaleneg_ak; break;
5790 case opClip2 : func = &clip2_ak; break;
5791 case opFold2 : func = &fold2_ak; break;
5792 case opWrap2 : func = &wrap2_ak; break;
5793 case opExcess : func = &excess_ak; break;
5794 case opFirstArg : func = &firstarg_aa; break;
5795 //case opSecondArg : func = &secondarg_aa; break;
5796 default : func = &add_ak; break;
5798 break;
5799 case calc_ScalarRate :
5800 switch (unit->mSpecialIndex) {
5801 //case opSilence2 : func = &zero_aa; break;
5802 case opAdd : func = &add_ai; break;
5803 case opSub : func = &sub_ai; break;
5804 case opMul : func = &mul_ai; break;
5805 case opFDiv : func = &div_ai; break;
5806 case opMod : func = &mod_ai; break;
5807 case opEQ : func = &eq_ai; break;
5808 case opNE : func = &neq_ai; break;
5809 case opLT : func = &lt_ai; break;
5810 case opGT : func = &gt_ai; break;
5811 case opLE : func = &le_ai; break;
5812 case opGE : func = &ge_ai; break;
5813 case opMin : func = &min_ai; break;
5814 case opMax : func = &max_ai; break;
5815 case opBitAnd : func = &and_ai; break;
5816 case opBitOr : func = &or_ai; break;
5817 case opBitXor : func = &xor_ai; break;
5818 case opShiftRight : func = &rightShift_ai; break;
5819 case opShiftLeft : func = &leftShift_ai; break;
5820 case opRound : func = &round_ai; break;
5821 case opRoundUp : func = &roundUp_ai; break;
5822 case opTrunc : func = &trunc_ai; break;
5823 case opAtan2 : func = &atan2_ai; break;
5824 case opHypot : func = &hypot_ai; break;
5825 case opHypotx : func = &hypotx_ai; break;
5826 case opPow : func = &pow_ai; break;
5827 case opRing1 : func = &ring1_ai; break;
5828 case opRing2 : func = &ring2_ai; break;
5829 case opRing3 : func = &ring3_ai; break;
5830 case opRing4 : func = &ring4_ai; break;
5831 case opDifSqr : func = &difsqr_ai; break;
5832 case opSumSqr : func = &sumsqr_ai; break;
5833 case opSqrSum : func = &sqrsum_ai; break;
5834 case opSqrDif : func = &sqrdif_ai; break;
5835 case opAbsDif : func = &absdif_ai; break;
5836 case opThresh : func = &thresh_ai; break;
5837 case opAMClip : func = &amclip_ai; break;
5838 case opScaleNeg : func = &scaleneg_ai; break;
5839 case opClip2 : func = &clip2_ai; break;
5840 case opFold2 : func = &fold2_ai; break;
5841 case opWrap2 : func = &wrap2_ai; break;
5842 case opExcess : func = &excess_ai; break;
5843 case opFirstArg : func = &firstarg_aa; break;
5844 //case opSecondArg : func = &secondarg_aa; break;
5845 default : func = &add_ai; break;
5848 break;
5849 case calc_BufRate :
5850 if (rateB == calc_FullRate) {
5851 switch (unit->mSpecialIndex) {
5852 //case opSilence2 : func = &zero_aa; break;
5853 case opAdd : func = &add_ka; break;
5854 case opSub : func = &sub_ka; break;
5855 case opMul : func = &mul_ka; break;
5856 case opFDiv : func = &div_ka; break;
5857 case opMod : func = &mod_ka; break;
5858 case opEQ : func = &eq_ka; break;
5859 case opNE : func = &neq_ka; break;
5860 case opLT : func = &lt_ka; break;
5861 case opGT : func = &gt_ka; break;
5862 case opLE : func = &le_ka; break;
5863 case opGE : func = &ge_ka; break;
5864 case opMin : func = &min_ka; break;
5865 case opMax : func = &max_ka; break;
5866 case opBitAnd : func = &and_ka; break;
5867 case opBitOr : func = &or_ka; break;
5868 case opBitXor : func = &xor_ka; break;
5869 case opShiftRight : func = &rightShift_ka; break;
5870 case opShiftLeft : func = &leftShift_ka; break;
5871 case opRound : func = &round_ka; break;
5872 case opRoundUp : func = &roundUp_ka; break;
5873 case opTrunc : func = &trunc_ka; break;
5874 case opAtan2 : func = &atan2_ka; break;
5875 case opHypot : func = &hypot_ka; break;
5876 case opHypotx : func = &hypotx_ka; break;
5877 case opPow : func = &pow_ka; break;
5878 case opRing1 : func = &ring1_ka; break;
5879 case opRing2 : func = &ring2_ka; break;
5880 case opRing3 : func = &ring3_ka; break;
5881 case opRing4 : func = &ring4_ka; break;
5882 case opDifSqr : func = &difsqr_ka; break;
5883 case opSumSqr : func = &sumsqr_ka; break;
5884 case opSqrSum : func = &sqrsum_ka; break;
5885 case opSqrDif : func = &sqrdif_ka; break;
5886 case opAbsDif : func = &absdif_ka; break;
5887 case opThresh : func = &thresh_ka; break;
5888 case opAMClip : func = &amclip_ka; break;
5889 case opScaleNeg : func = &scaleneg_ka; break;
5890 case opClip2 : func = &clip2_ka; break;
5891 case opFold2 : func = &fold2_ka; break;
5892 case opWrap2 : func = &wrap2_ka; break;
5893 case opExcess : func = &excess_ka; break;
5894 //case opFirstArg : func = &firstarg_aa; break;
5895 //case opSecondArg : func = &secondarg_aa; break;
5896 default : func = &add_ka; break;
5898 } else {
5899 // this should have been caught by mBufLength == 1
5900 func = &zero_aa;
5902 break;
5903 case calc_ScalarRate :
5904 if (rateB == calc_FullRate) {
5905 switch (unit->mSpecialIndex) {
5906 //case opSilence2 : func = &zero_aa; break;
5907 case opAdd : func = &add_ia; break;
5908 case opSub : func = &sub_ia; break;
5909 case opMul : func = &mul_ia; break;
5910 case opFDiv : func = &div_ia; break;
5911 case opMod : func = &mod_ia; break;
5912 case opEQ : func = &eq_ia; break;
5913 case opNE : func = &neq_ia; break;
5914 case opLT : func = &lt_ia; break;
5915 case opGT : func = &gt_ia; break;
5916 case opLE : func = &le_ia; break;
5917 case opGE : func = &ge_ia; break;
5918 case opMin : func = &min_ia; break;
5919 case opMax : func = &max_ia; break;
5920 case opBitAnd : func = &and_ia; break;
5921 case opBitOr : func = &or_ia; break;
5922 case opBitXor : func = &xor_ia; break;
5923 case opShiftRight : func = &rightShift_ia; break;
5924 case opShiftLeft : func = &leftShift_ia; break;
5925 case opRound : func = &round_ia; break;
5926 case opRoundUp : func = &roundUp_ia; break;
5927 case opTrunc : func = &trunc_ia; break;
5928 case opAtan2 : func = &atan2_ia; break;
5929 case opHypot : func = &hypot_ia; break;
5930 case opHypotx : func = &hypotx_ia; break;
5931 case opPow : func = &pow_ia; break;
5932 case opRing1 : func = &ring1_ia; break;
5933 case opRing2 : func = &ring2_ia; break;
5934 case opRing3 : func = &ring3_ia; break;
5935 case opRing4 : func = &ring4_ia; break;
5936 case opDifSqr : func = &difsqr_ia; break;
5937 case opSumSqr : func = &sumsqr_ia; break;
5938 case opSqrSum : func = &sqrsum_ia; break;
5939 case opSqrDif : func = &sqrdif_ia; break;
5940 case opAbsDif : func = &absdif_ia; break;
5941 case opThresh : func = &thresh_ia; break;
5942 case opAMClip : func = &amclip_ia; break;
5943 case opScaleNeg : func = &scaleneg_ia; break;
5944 case opClip2 : func = &clip2_ia; break;
5945 case opFold2 : func = &fold2_ia; break;
5946 case opWrap2 : func = &wrap2_ia; break;
5947 case opExcess : func = &excess_ia; break;
5948 //case opFirstArg : func = &firstarg_aa; break;
5949 //case opSecondArg : func = &secondarg_aa; break;
5950 default : func = &add_ia; break;
5952 } else {
5953 // this should have been caught by mBufLength == 1
5954 func = &zero_aa;
5956 break;
5959 return func;
5962 #ifdef NOVA_SIMD
5963 static BinaryOpFunc ChooseNovaSimdFunc_64(BinaryOpUGen *unit)
5965 BinaryOpFunc func = &zero_1;
5967 int rateA = INRATE(0);
5968 int rateB = INRATE(1);
5970 switch (rateA) {
5971 case calc_FullRate:
5972 switch (rateB) {
5973 case calc_FullRate:
5974 switch (unit->mSpecialIndex) {
5975 //case opSilence2 : func = &zero_aa; break;
5976 case opAdd : func = &add_aa_nova_64; break;
5977 case opSub : func = &sub_aa_nova_64; break;
5978 case opMul : func = &mul_aa_nova_64; break;
5979 case opFDiv : func = &div_aa_nova; break;
5980 case opMod : func = &mod_aa; break;
5981 case opEQ : func = &eq_aa_nova_64; break;
5982 case opNE : func = &neq_aa_nova_64; break;
5983 case opLT : func = &lt_aa_nova_64; break;
5984 case opGT : func = &gt_aa_nova_64; break;
5985 case opLE : func = &le_aa_nova_64; break;
5986 case opGE : func = &ge_aa_nova_64; break;
5987 case opMin : func = &min_aa_nova_64; break;
5988 case opMax : func = &max_aa_nova_64; break;
5989 case opBitAnd : func = &and_aa; break;
5990 case opBitOr : func = &or_aa; break;
5991 case opBitXor : func = &xor_aa; break;
5992 case opShiftRight : func = &rightShift_aa; break;
5993 case opShiftLeft : func = &leftShift_aa; break;
5994 case opRound : func = &round_aa; break;
5995 case opRoundUp : func = &roundUp_aa; break;
5996 case opTrunc : func = &trunc_aa; break;
5997 case opAtan2 : func = &atan2_aa; break;
5998 case opHypot : func = &hypot_aa; break;
5999 case opHypotx : func = &hypotx_aa; break;
6000 case opPow : func = &pow_aa_nova; break;
6001 case opRing1 : func = &ring1_aa; break;
6002 case opRing2 : func = &ring2_aa; break;
6003 case opRing3 : func = &ring3_aa; break;
6004 case opRing4 : func = &ring4_aa; break;
6005 case opDifSqr : func = &difsqr_aa; break;
6006 case opSumSqr : func = &sumsqr_aa; break;
6007 case opSqrSum : func = &sqrsum_aa; break;
6008 case opSqrDif : func = &sqrdif_aa; break;
6009 case opAbsDif : func = &absdif_aa; break;
6010 case opThresh : func = &thresh_aa; break;
6011 case opAMClip : func = &amclip_aa; break;
6012 case opScaleNeg : func = &scaleneg_aa; break;
6013 case opClip2 : func = &clip2_aa_nova_64; break;
6014 case opFold2 : func = &fold2_aa; break;
6015 case opWrap2 : func = &wrap2_aa; break;
6016 case opExcess : func = &excess_aa; break;
6017 case opFirstArg : func = &firstarg_aa_nova; break;
6018 //case opSecondArg : func = &secondarg_aa_nova; break;
6019 default : func = &add_aa; break;
6021 break;
6022 case calc_BufRate :
6023 switch (unit->mSpecialIndex) {
6024 //case opSilence2 : func = &zero_aa; break;
6025 case opAdd : func = &add_ak_nova_64; break;
6026 case opSub : func = &sub_ak_nova_64; break;
6027 case opMul : func = &mul_ak_nova_64; break;
6028 case opFDiv : func = &div_ak_nova; break;
6029 case opMod : func = &mod_ak; break;
6030 case opEQ : func = &eq_ak_nova_64; break;
6031 case opNE : func = &neq_ak_nova_64; break;
6032 case opLT : func = &lt_ak_nova_64; break;
6033 case opGT : func = &gt_ak_nova_64; break;
6034 case opLE : func = &le_ak_nova_64; break;
6035 case opGE : func = &ge_ak_nova_64; break;
6036 case opMin : func = &min_ak_nova_64; break;
6037 case opMax : func = &max_ak_nova_64; break;
6038 case opBitAnd : func = &and_ak; break;
6039 case opBitOr : func = &or_ak; break;
6040 case opBitXor : func = &xor_ak; break;
6041 case opShiftRight : func = &rightShift_ak; break;
6042 case opShiftLeft : func = &leftShift_ak; break;
6043 case opRound : func = &round_ak; break;
6044 case opRoundUp : func = &roundUp_ak; break;
6045 case opTrunc : func = &trunc_ak; break;
6046 case opAtan2 : func = &atan2_ak; break;
6047 case opHypot : func = &hypot_ak; break;
6048 case opHypotx : func = &hypotx_ak; break;
6049 case opPow : func = &pow_ak_nova; break;
6050 case opRing1 : func = &ring1_ak; break;
6051 case opRing2 : func = &ring2_ak; break;
6052 case opRing3 : func = &ring3_ak; break;
6053 case opRing4 : func = &ring4_ak; break;
6054 case opDifSqr : func = &difsqr_ak; break;
6055 case opSumSqr : func = &sumsqr_ak; break;
6056 case opSqrSum : func = &sqrsum_ak; break;
6057 case opSqrDif : func = &sqrdif_ak; break;
6058 case opAbsDif : func = &absdif_ak; break;
6059 case opThresh : func = &thresh_ak; break;
6060 case opAMClip : func = &amclip_ak; break;
6061 case opScaleNeg : func = &scaleneg_ak; break;
6062 case opClip2 : func = &clip2_ak_nova_64; break;
6063 case opFold2 : func = &fold2_ak; break;
6064 case opWrap2 : func = &wrap2_ak; break;
6065 case opExcess : func = &excess_ak; break;
6066 case opFirstArg : func = &firstarg_aa; break;
6067 //case opSecondArg : func = &secondarg_aa; break;
6068 default : func = &add_ak; break;
6070 break;
6071 case calc_ScalarRate :
6072 switch (unit->mSpecialIndex) {
6073 //case opSilence2 : func = &zero_aa; break;
6074 case opAdd : func = &add_ai_nova_64; break;
6075 case opSub : func = &sub_ai_nova_64; break;
6076 case opMul : func = &mul_ai_nova_64; break;
6077 case opFDiv : func = &div_ai_nova; break;
6078 case opMod : func = &mod_ai; break;
6079 case opEQ : func = &eq_ai_nova_64; break;
6080 case opNE : func = &neq_ai_nova_64; break;
6081 case opLT : func = &lt_ai_nova_64; break;
6082 case opGT : func = &gt_ai_nova_64; break;
6083 case opLE : func = &le_ai_nova_64; break;
6084 case opGE : func = &ge_ai_nova_64; break;
6085 case opMin : func = &min_ai_nova_64; break;
6086 case opMax : func = &max_ai_nova_64; break;
6087 case opBitAnd : func = &and_ai; break;
6088 case opBitOr : func = &or_ai; break;
6089 case opBitXor : func = &xor_ai; break;
6090 case opShiftRight : func = &rightShift_ai; break;
6091 case opShiftLeft : func = &leftShift_ai; break;
6092 case opRound : func = &round_ai; break;
6093 case opRoundUp : func = &roundUp_ai; break;
6094 case opTrunc : func = &trunc_ai; break;
6095 case opAtan2 : func = &atan2_ai; break;
6096 case opHypot : func = &hypot_ai; break;
6097 case opHypotx : func = &hypotx_ai; break;
6098 case opPow : func = &pow_ai_nova; break;
6099 case opRing1 : func = &ring1_ai; break;
6100 case opRing2 : func = &ring2_ai; break;
6101 case opRing3 : func = &ring3_ai; break;
6102 case opRing4 : func = &ring4_ai; break;
6103 case opDifSqr : func = &difsqr_ai; break;
6104 case opSumSqr : func = &sumsqr_ai; break;
6105 case opSqrSum : func = &sqrsum_ai; break;
6106 case opSqrDif : func = &sqrdif_ai; break;
6107 case opAbsDif : func = &absdif_ai; break;
6108 case opThresh : func = &thresh_ai; break;
6109 case opAMClip : func = &amclip_ai; break;
6110 case opScaleNeg : func = &scaleneg_ai; break;
6111 case opClip2 : func = &clip2_ai_nova_64; break;
6112 case opFold2 : func = &fold2_ai; break;
6113 case opWrap2 : func = &wrap2_ai; break;
6114 case opExcess : func = &excess_ai; break;
6115 case opFirstArg : func = &firstarg_aa; break;
6116 //case opSecondArg : func = &secondarg_aa; break;
6117 default : func = &add_ai; break;
6120 break;
6121 case calc_BufRate :
6122 if (rateB == calc_FullRate) {
6123 switch (unit->mSpecialIndex) {
6124 //case opSilence2 : func = &zero_aa; break;
6125 case opAdd : func = &add_ka_nova_64; break;
6126 case opSub : func = &sub_ka_nova_64; break;
6127 case opMul : func = &mul_ka_nova_64; break;
6128 case opFDiv : func = &div_ka_nova; break;
6129 case opMod : func = &mod_ka; break;
6130 case opEQ : func = &eq_ka_nova_64; break;
6131 case opNE : func = &neq_ka_nova_64; break;
6132 case opLT : func = &lt_ka_nova_64; break;
6133 case opGT : func = &gt_ka_nova_64; break;
6134 case opLE : func = &le_ka_nova_64; break;
6135 case opGE : func = &ge_ka_nova_64; break;
6136 case opMin : func = &min_ka_nova_64; break;
6137 case opMax : func = &max_ka_nova_64; break;
6138 case opBitAnd : func = &and_ka; break;
6139 case opBitOr : func = &or_ka; break;
6140 case opBitXor : func = &xor_ka; break;
6141 case opShiftRight : func = &rightShift_ka; break;
6142 case opShiftLeft : func = &leftShift_ka; break;
6143 case opRound : func = &round_ka; break;
6144 case opRoundUp : func = &roundUp_ka; break;
6145 case opTrunc : func = &trunc_ka; break;
6146 case opAtan2 : func = &atan2_ka; break;
6147 case opHypot : func = &hypot_ka; break;
6148 case opHypotx : func = &hypotx_ka; break;
6149 case opPow : func = &pow_ka_nova; break;
6150 case opRing1 : func = &ring1_ka; break;
6151 case opRing2 : func = &ring2_ka; break;
6152 case opRing3 : func = &ring3_ka; break;
6153 case opRing4 : func = &ring4_ka; break;
6154 case opDifSqr : func = &difsqr_ka; break;
6155 case opSumSqr : func = &sumsqr_ka; break;
6156 case opSqrSum : func = &sqrsum_ka; break;
6157 case opSqrDif : func = &sqrdif_ka; break;
6158 case opAbsDif : func = &absdif_ka; break;
6159 case opThresh : func = &thresh_ka; break;
6160 case opAMClip : func = &amclip_ka; break;
6161 case opScaleNeg : func = &scaleneg_ka; break;
6162 case opClip2 : func = &clip2_ka_nova_64; break;
6163 case opFold2 : func = &fold2_ka; break;
6164 case opWrap2 : func = &wrap2_ka; break;
6165 case opExcess : func = &excess_ka; break;
6166 //case opFirstArg : func = &firstarg_aa; break;
6167 //case opSecondArg : func = &secondarg_aa; break;
6168 default : func = &add_ka; break;
6170 } else {
6171 // this should have been caught by mBufLength == 1
6172 func = &zero_aa;
6174 break;
6175 case calc_ScalarRate :
6176 if (rateB == calc_FullRate) {
6177 switch (unit->mSpecialIndex) {
6178 //case opSilence2 : func = &zero_aa; break;
6179 case opAdd : func = &add_ia_nova_64; break;
6180 case opSub : func = &sub_ia_nova_64; break;
6181 case opMul : func = &mul_ia_nova_64; break;
6182 case opFDiv : func = &div_ia_nova; break;
6183 case opMod : func = &mod_ia; break;
6184 case opEQ : func = &eq_ia_nova_64; break;
6185 case opNE : func = &neq_ia_nova_64; break;
6186 case opLT : func = &lt_ia_nova_64; break;
6187 case opGT : func = &gt_ia_nova_64; break;
6188 case opLE : func = &le_ia_nova_64; break;
6189 case opGE : func = &ge_ia_nova_64; break;
6190 case opMin : func = &min_ia_nova_64; break;
6191 case opMax : func = &max_ia_nova_64; break;
6192 case opBitAnd : func = &and_ia; break;
6193 case opBitOr : func = &or_ia; break;
6194 case opBitXor : func = &xor_ia; break;
6195 case opShiftRight : func = &rightShift_ia; break;
6196 case opShiftLeft : func = &leftShift_ia; break;
6197 case opRound : func = &round_ia; break;
6198 case opRoundUp : func = &roundUp_ia; break;
6199 case opTrunc : func = &trunc_ia; break;
6200 case opAtan2 : func = &atan2_ia; break;
6201 case opHypot : func = &hypot_ia; break;
6202 case opHypotx : func = &hypotx_ia; break;
6203 case opPow : func = &pow_ia_nova; break;
6204 case opRing1 : func = &ring1_ia; break;
6205 case opRing2 : func = &ring2_ia; break;
6206 case opRing3 : func = &ring3_ia; break;
6207 case opRing4 : func = &ring4_ia; break;
6208 case opDifSqr : func = &difsqr_ia; break;
6209 case opSumSqr : func = &sumsqr_ia; break;
6210 case opSqrSum : func = &sqrsum_ia; break;
6211 case opSqrDif : func = &sqrdif_ia; break;
6212 case opAbsDif : func = &absdif_ia; break;
6213 case opThresh : func = &thresh_ia; break;
6214 case opAMClip : func = &amclip_ia; break;
6215 case opScaleNeg : func = &scaleneg_ia; break;
6216 case opClip2 : func = &clip2_ia_nova_64; break;
6217 case opFold2 : func = &fold2_ia; break;
6218 case opWrap2 : func = &wrap2_ia; break;
6219 case opExcess : func = &excess_ia; break;
6220 //case opFirstArg : func = &firstarg_aa; break;
6221 //case opSecondArg : func = &secondarg_aa; break;
6222 default : func = &add_ia; break;
6224 } else {
6225 // this should have been caught by mBufLength == 1
6226 func = &zero_aa;
6228 break;
6231 return func;
6235 static BinaryOpFunc ChooseNovaSimdFunc(BinaryOpUGen *unit)
6237 if (BUFLENGTH == 64)
6238 return ChooseNovaSimdFunc_64(unit);
6240 BinaryOpFunc func = &zero_1;
6242 int rateA = INRATE(0);
6243 int rateB = INRATE(1);
6245 switch (rateA) {
6246 case calc_FullRate:
6247 switch (rateB) {
6248 case calc_FullRate:
6249 switch (unit->mSpecialIndex) {
6250 //case opSilence2 : func = &zero_aa; break;
6251 case opAdd : func = &add_aa_nova; break;
6252 case opSub : func = &sub_aa_nova; break;
6253 case opMul : func = &mul_aa_nova; break;
6254 case opFDiv : func = &div_aa_nova; break;
6255 case opMod : func = &mod_aa; break;
6256 case opEQ : func = &eq_aa_nova; break;
6257 case opNE : func = &neq_aa_nova; break;
6258 case opLT : func = &lt_aa_nova; break;
6259 case opGT : func = &gt_aa_nova; break;
6260 case opLE : func = &le_aa_nova; break;
6261 case opGE : func = &ge_aa_nova; break;
6262 case opMin : func = &min_aa_nova; break;
6263 case opMax : func = &max_aa_nova; break;
6264 case opBitAnd : func = &and_aa; break;
6265 case opBitOr : func = &or_aa; break;
6266 case opBitXor : func = &xor_aa; break;
6267 case opShiftRight : func = &rightShift_aa; break;
6268 case opShiftLeft : func = &leftShift_aa; break;
6269 case opRound : func = &round_aa; break;
6270 case opRoundUp : func = &roundUp_aa; break;
6271 case opTrunc : func = &trunc_aa; break;
6272 case opAtan2 : func = &atan2_aa; break;
6273 case opHypot : func = &hypot_aa; break;
6274 case opHypotx : func = &hypotx_aa; break;
6275 case opPow : func = &pow_aa_nova; break;
6276 case opRing1 : func = &ring1_aa; break;
6277 case opRing2 : func = &ring2_aa; break;
6278 case opRing3 : func = &ring3_aa; break;
6279 case opRing4 : func = &ring4_aa; break;
6280 case opDifSqr : func = &difsqr_aa; break;
6281 case opSumSqr : func = &sumsqr_aa; break;
6282 case opSqrSum : func = &sqrsum_aa; break;
6283 case opSqrDif : func = &sqrdif_aa; break;
6284 case opAbsDif : func = &absdif_aa; break;
6285 case opThresh : func = &thresh_aa; break;
6286 case opAMClip : func = &amclip_aa; break;
6287 case opScaleNeg : func = &scaleneg_aa; break;
6288 case opClip2 : func = &clip2_aa_nova; break;
6289 case opFold2 : func = &fold2_aa; break;
6290 case opWrap2 : func = &wrap2_aa; break;
6291 case opExcess : func = &excess_aa; break;
6292 case opFirstArg : func = &firstarg_aa_nova; break;
6293 //case opSecondArg : func = &secondarg_aa_nova; break;
6294 default : func = &add_aa; break;
6296 break;
6297 case calc_BufRate :
6298 switch (unit->mSpecialIndex) {
6299 //case opSilence2 : func = &zero_aa; break;
6300 case opAdd : func = &add_ak_nova; break;
6301 case opSub : func = &sub_ak_nova; break;
6302 case opMul : func = &mul_ak_nova; break;
6303 case opFDiv : func = &div_ak_nova; break;
6304 case opMod : func = &mod_ak; break;
6305 case opEQ : func = &eq_ak_nova; break;
6306 case opNE : func = &neq_ak_nova; break;
6307 case opLT : func = &lt_ak_nova; break;
6308 case opGT : func = &gt_ak_nova; break;
6309 case opLE : func = &le_ak_nova; break;
6310 case opGE : func = &ge_ak_nova; break;
6311 case opMin : func = &min_ak_nova; break;
6312 case opMax : func = &max_ak_nova; break;
6313 case opBitAnd : func = &and_ak; break;
6314 case opBitOr : func = &or_ak; break;
6315 case opBitXor : func = &xor_ak; break;
6316 case opShiftRight : func = &rightShift_ak; break;
6317 case opShiftLeft : func = &leftShift_ak; break;
6318 case opRound : func = &round_ak; break;
6319 case opRoundUp : func = &roundUp_ak; break;
6320 case opTrunc : func = &trunc_ak; break;
6321 case opAtan2 : func = &atan2_ak; break;
6322 case opHypot : func = &hypot_ak; break;
6323 case opHypotx : func = &hypotx_ak; break;
6324 case opPow : func = &pow_ak_nova; break;
6325 case opRing1 : func = &ring1_ak; break;
6326 case opRing2 : func = &ring2_ak; break;
6327 case opRing3 : func = &ring3_ak; break;
6328 case opRing4 : func = &ring4_ak; break;
6329 case opDifSqr : func = &difsqr_ak; break;
6330 case opSumSqr : func = &sumsqr_ak; break;
6331 case opSqrSum : func = &sqrsum_ak; break;
6332 case opSqrDif : func = &sqrdif_ak; break;
6333 case opAbsDif : func = &absdif_ak; break;
6334 case opThresh : func = &thresh_ak; break;
6335 case opAMClip : func = &amclip_ak; break;
6336 case opScaleNeg : func = &scaleneg_ak; break;
6337 case opClip2 : func = &clip2_ak_nova; break;
6338 case opFold2 : func = &fold2_ak; break;
6339 case opWrap2 : func = &wrap2_ak; break;
6340 case opExcess : func = &excess_ak; break;
6341 case opFirstArg : func = &firstarg_aa; break;
6342 //case opSecondArg : func = &secondarg_aa; break;
6343 default : func = &add_ak; break;
6345 break;
6346 case calc_ScalarRate :
6347 switch (unit->mSpecialIndex) {
6348 //case opSilence2 : func = &zero_aa; break;
6349 case opAdd : func = &add_ai_nova; break;
6350 case opSub : func = &sub_ai_nova; break;
6351 case opMul : func = &mul_ai_nova; break;
6352 case opFDiv : func = &div_ai_nova; break;
6353 case opMod : func = &mod_ai; break;
6354 case opEQ : func = &eq_ai_nova; break;
6355 case opNE : func = &neq_ai_nova; break;
6356 case opLT : func = &lt_ai_nova; break;
6357 case opGT : func = &gt_ai_nova; break;
6358 case opLE : func = &le_ai_nova; break;
6359 case opGE : func = &ge_ai_nova; break;
6360 case opMin : func = &min_ai_nova; break;
6361 case opMax : func = &max_ai_nova; break;
6362 case opBitAnd : func = &and_ai; break;
6363 case opBitOr : func = &or_ai; break;
6364 case opBitXor : func = &xor_ai; break;
6365 case opShiftRight : func = &rightShift_ai; break;
6366 case opShiftLeft : func = &leftShift_ai; break;
6367 case opRound : func = &round_ai; break;
6368 case opRoundUp : func = &roundUp_ai; break;
6369 case opTrunc : func = &trunc_ai; break;
6370 case opAtan2 : func = &atan2_ai; break;
6371 case opHypot : func = &hypot_ai; break;
6372 case opHypotx : func = &hypotx_ai; break;
6373 case opPow : func = &pow_ai_nova; break;
6374 case opRing1 : func = &ring1_ai; break;
6375 case opRing2 : func = &ring2_ai; break;
6376 case opRing3 : func = &ring3_ai; break;
6377 case opRing4 : func = &ring4_ai; break;
6378 case opDifSqr : func = &difsqr_ai; break;
6379 case opSumSqr : func = &sumsqr_ai; break;
6380 case opSqrSum : func = &sqrsum_ai; break;
6381 case opSqrDif : func = &sqrdif_ai; break;
6382 case opAbsDif : func = &absdif_ai; break;
6383 case opThresh : func = &thresh_ai; break;
6384 case opAMClip : func = &amclip_ai; break;
6385 case opScaleNeg : func = &scaleneg_ai; break;
6386 case opClip2 : func = &clip2_ai_nova; break;
6387 case opFold2 : func = &fold2_ai; break;
6388 case opWrap2 : func = &wrap2_ai; break;
6389 case opExcess : func = &excess_ai; break;
6390 case opFirstArg : func = &firstarg_aa; break;
6391 //case opSecondArg : func = &secondarg_aa; break;
6392 default : func = &add_ai; break;
6395 break;
6396 case calc_BufRate :
6397 if (rateB == calc_FullRate) {
6398 switch (unit->mSpecialIndex) {
6399 //case opSilence2 : func = &zero_aa; break;
6400 case opAdd : func = &add_ka_nova; break;
6401 case opSub : func = &sub_ka_nova; break;
6402 case opMul : func = &mul_ka_nova; break;
6403 case opFDiv : func = &div_ka_nova; break;
6404 case opMod : func = &mod_ka; break;
6405 case opEQ : func = &eq_ka_nova; break;
6406 case opNE : func = &neq_ka_nova; break;
6407 case opLT : func = &lt_ka_nova; break;
6408 case opGT : func = &gt_ka_nova; break;
6409 case opLE : func = &le_ka_nova; break;
6410 case opGE : func = &ge_ka_nova; break;
6411 case opMin : func = &min_ka_nova; break;
6412 case opMax : func = &max_ka_nova; break;
6413 case opBitAnd : func = &and_ka; break;
6414 case opBitOr : func = &or_ka; break;
6415 case opBitXor : func = &xor_ka; break;
6416 case opShiftRight : func = &rightShift_ka; break;
6417 case opShiftLeft : func = &leftShift_ka; break;
6418 case opRound : func = &round_ka; break;
6419 case opRoundUp : func = &roundUp_ka; break;
6420 case opTrunc : func = &trunc_ka; break;
6421 case opAtan2 : func = &atan2_ka; break;
6422 case opHypot : func = &hypot_ka; break;
6423 case opHypotx : func = &hypotx_ka; break;
6424 case opPow : func = &pow_ka_nova; break;
6425 case opRing1 : func = &ring1_ka; break;
6426 case opRing2 : func = &ring2_ka; break;
6427 case opRing3 : func = &ring3_ka; break;
6428 case opRing4 : func = &ring4_ka; break;
6429 case opDifSqr : func = &difsqr_ka; break;
6430 case opSumSqr : func = &sumsqr_ka; break;
6431 case opSqrSum : func = &sqrsum_ka; break;
6432 case opSqrDif : func = &sqrdif_ka; break;
6433 case opAbsDif : func = &absdif_ka; break;
6434 case opThresh : func = &thresh_ka; break;
6435 case opAMClip : func = &amclip_ka; break;
6436 case opScaleNeg : func = &scaleneg_ka; break;
6437 case opClip2 : func = &clip2_ka_nova; break;
6438 case opFold2 : func = &fold2_ka; break;
6439 case opWrap2 : func = &wrap2_ka; break;
6440 case opExcess : func = &excess_ka; break;
6441 //case opFirstArg : func = &firstarg_aa; break;
6442 //case opSecondArg : func = &secondarg_aa; break;
6443 default : func = &add_ka; break;
6445 } else {
6446 // this should have been caught by mBufLength == 1
6447 func = &zero_aa;
6449 break;
6450 case calc_ScalarRate :
6451 if (rateB == calc_FullRate) {
6452 switch (unit->mSpecialIndex) {
6453 //case opSilence2 : func = &zero_aa; break;
6454 case opAdd : func = &add_ia_nova; break;
6455 case opSub : func = &sub_ia_nova; break;
6456 case opMul : func = &mul_ia_nova; break;
6457 case opFDiv : func = &div_ia_nova; break;
6458 case opMod : func = &mod_ia; break;
6459 case opEQ : func = &eq_ia_nova; break;
6460 case opNE : func = &neq_ia_nova; break;
6461 case opLT : func = &lt_ia_nova; break;
6462 case opGT : func = &gt_ia_nova; break;
6463 case opLE : func = &le_ia_nova; break;
6464 case opGE : func = &ge_ia_nova; break;
6465 case opMin : func = &min_ia_nova; break;
6466 case opMax : func = &max_ia_nova; break;
6467 case opBitAnd : func = &and_ia; break;
6468 case opBitOr : func = &or_ia; break;
6469 case opBitXor : func = &xor_ia; break;
6470 case opShiftRight : func = &rightShift_ia; break;
6471 case opShiftLeft : func = &leftShift_ia; break;
6472 case opRound : func = &round_ia; break;
6473 case opRoundUp : func = &roundUp_ia; break;
6474 case opTrunc : func = &trunc_ia; break;
6475 case opAtan2 : func = &atan2_ia; break;
6476 case opHypot : func = &hypot_ia; break;
6477 case opHypotx : func = &hypotx_ia; break;
6478 case opPow : func = &pow_ia_nova; break;
6479 case opRing1 : func = &ring1_ia; break;
6480 case opRing2 : func = &ring2_ia; break;
6481 case opRing3 : func = &ring3_ia; break;
6482 case opRing4 : func = &ring4_ia; break;
6483 case opDifSqr : func = &difsqr_ia; break;
6484 case opSumSqr : func = &sumsqr_ia; break;
6485 case opSqrSum : func = &sqrsum_ia; break;
6486 case opSqrDif : func = &sqrdif_ia; break;
6487 case opAbsDif : func = &absdif_ia; break;
6488 case opThresh : func = &thresh_ia; break;
6489 case opAMClip : func = &amclip_ia; break;
6490 case opScaleNeg : func = &scaleneg_ia; break;
6491 case opClip2 : func = &clip2_ia_nova; break;
6492 case opFold2 : func = &fold2_ia; break;
6493 case opWrap2 : func = &wrap2_ia; break;
6494 case opExcess : func = &excess_ia; break;
6495 //case opFirstArg : func = &firstarg_aa; break;
6496 //case opSecondArg : func = &secondarg_aa; break;
6497 default : func = &add_ia; break;
6499 } else {
6500 // this should have been caught by mBufLength == 1
6501 func = &zero_aa;
6503 break;
6506 return func;
6509 #endif
6511 bool ChooseOperatorFunc(BinaryOpUGen *unit)
6513 //Print("->ChooseOperatorFunc %d\n", unit->mSpecialIndex);
6514 BinaryOpFunc func = &zero_aa;
6515 bool ret = false;
6517 if (BUFLENGTH == 1) {
6518 if (unit->mCalcRate == calc_DemandRate) {
6519 func = ChooseDemandFunc(unit);
6520 } else {
6521 func = ChooseOneSampleFunc(unit);
6523 #if defined(NOVA_SIMD)
6524 } else if (!(BUFLENGTH & 15)) {
6525 /* select normal function for initialization */
6526 func = ChooseNormalFunc(unit);
6527 func(unit, 1);
6529 /* select simd function */
6530 func = ChooseNovaSimdFunc(unit);
6531 ret = true;
6532 #endif
6533 } else {
6534 func = ChooseNormalFunc(unit);
6536 unit->mCalcFunc = (UnitCalcFunc)func;
6537 //Print("<-ChooseOperatorFunc %p\n", func);
6538 //Print("calc %d\n", unit->mCalcRate);
6539 return ret;
6545 ////////////////////////////////////////////////////////////////////////////////////////////////////////
6548 PluginLoad(BinaryOp)
6550 ft = inTable;
6552 DefineSimpleUnit(BinaryOpUGen);