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
21 #include "PyrKernel.h"
22 #include "PyrPrimitive.h"
23 #include "PyrMathPrim.h"
24 #include "MiscInlineMath.h"
25 #include "SC_InlineUnaryOp.h"
26 #include "SC_InlineBinaryOp.h"
27 #include "PyrSignal.h"
28 #include "PyrParseNode.h"
29 #include "PyrMessage.h"
34 #include "SC_Endian.h"
37 #include "boost/math/special_functions.hpp"
39 const int INT_MAX_BY_PyrSlot
= INT_MAX
/ sizeof(PyrSlot
);
41 inline bool IsSignal(PyrSlot
* slot
) { return (IsObj(slot
) && slotRawObject(slot
)->classptr
== class_signal
); }
42 inline bool NotSignal(PyrSlot
* slot
) { return (NotObj(slot
) || slotRawObject(slot
)->classptr
!= class_signal
); }
45 /* functors for dispatching template code */
49 static inline double run(double lhs
, double rhs
)
53 static inline int run(int lhs
, int rhs
)
57 static inline PyrObject
* signal_xf(VMGlobals
*g
, PyrObject
* ina
, float inb
)
59 return signal_add_xf(g
, ina
, inb
);
61 static inline PyrObject
* signal_fx(VMGlobals
*g
, float ina
, PyrObject
* inb
)
63 return signal_xf(g
, inb
, ina
);
65 static inline PyrObject
* signal_xx(VMGlobals
*g
, PyrObject
* ina
, PyrObject
* inb
)
67 return signal_add_xx(g
, ina
, inb
);
73 static inline double run(double lhs
, double rhs
)
77 static inline int run(int lhs
, int rhs
)
81 static inline PyrObject
* signal_xf(VMGlobals
*g
, PyrObject
* ina
, float inb
)
83 return signal_mul_xf(g
, ina
, inb
);
85 static inline PyrObject
* signal_fx(VMGlobals
*g
, float ina
, PyrObject
* inb
)
87 return signal_xf(g
, inb
, ina
);
89 static inline PyrObject
* signal_xx(VMGlobals
*g
, PyrObject
* ina
, PyrObject
* inb
)
91 return signal_mul_xx(g
, ina
, inb
);
97 static inline double run(double lhs
, double rhs
)
101 static inline int run(int lhs
, int rhs
)
105 static inline PyrObject
* signal_xf(VMGlobals
*g
, PyrObject
* ina
, float inb
)
107 return signal_sub_xf(g
, ina
, inb
);
109 static inline PyrObject
* signal_fx(VMGlobals
*g
, float ina
, PyrObject
* inb
)
111 return signal_sub_fx(g
, ina
, inb
);
113 static inline PyrObject
* signal_xx(VMGlobals
*g
, PyrObject
* ina
, PyrObject
* inb
)
115 return signal_sub_xx(g
, ina
, inb
);
119 template <typename Functor
>
120 inline int prOpNum(VMGlobals
*g
, int numArgsPushed
)
132 SetRaw(a
, Functor::run(slotRawInt(a
), slotRawInt(b
)));
141 SetSymbol(a
, slotRawSymbol(b
));
144 if (isKindOf(slotRawObject(b
), class_signal
))
145 SetObject(a
, Functor::signal_fx(g
, slotRawInt(a
), slotRawObject(b
)));
150 SetFloat(a
, slotRawInt(a
) + slotRawFloat(b
));
164 if (isKindOf(slotRawObject(a
), class_signal
)) {
167 SetRaw(a
, Functor::signal_xf(g
, slotRawObject(a
), slotRawInt(b
)));
176 SetSymbol(a
, slotRawSymbol(b
));
179 if (isKindOf(slotRawObject(b
), class_signal
)) {
180 SetRaw(a
, Functor::signal_xx(g
, slotRawObject(a
), slotRawObject(b
)));
185 SetRaw(a
, Functor::signal_xf(g
, slotRawObject(a
), slotRawFloat(b
)));
194 SetRaw(a
, Functor::run(slotRawFloat(a
), (double)slotRawInt(b
)));
203 SetSymbol(a
, slotRawSymbol(b
));
206 if (isKindOf(slotRawObject(b
), class_signal
))
207 SetObject(a
, Functor::signal_fx(g
, slotRawFloat(a
), slotRawObject(b
)));
212 SetRaw(a
, Functor::run(slotRawFloat(a
), slotRawFloat(b
)));
225 if (numArgsPushed
!= -1) // special case flag meaning it is a primitive
226 return errFailed
; // arguments remain on the stack
228 msg
= gSpecialBinarySelectors
[g
->primitiveIndex
];
229 sendMessage(g
, msg
, 2);
233 template <typename Functor
>
234 inline int prOpInt(VMGlobals
*g
, int numArgsPushed
)
244 SetRaw(a
, Functor::run(slotRawInt(a
), slotRawInt(b
)));
253 SetSymbol(a
, slotRawSymbol(b
));
256 if (isKindOf(slotRawObject(b
), class_signal
))
257 SetObject(a
, Functor::signal_fx(g
, slotRawInt(a
), slotRawObject(b
)));
262 SetFloat(a
, Functor::run((double)slotRawInt(a
), slotRawFloat(b
)));
273 if (numArgsPushed
!= -1) // special case flag meaning it is a primitive
274 return errFailed
; // arguments remain on the stack
276 msg
= gSpecialBinarySelectors
[g
->primitiveIndex
];
277 sendMessage(g
, msg
, 2);
281 template <typename Functor
>
282 inline int prOpFloat(VMGlobals
*g
, int numArgsPushed
)
292 SetRaw(a
, Functor::run(slotRawFloat(a
), (double)slotRawInt(b
)));
301 SetSymbol(a
, slotRawSymbol(b
));
304 if (isKindOf(slotRawObject(b
), class_signal
))
305 SetObject(a
, Functor::signal_fx(g
, slotRawFloat(a
), slotRawObject(b
)));
310 SetRaw(a
, Functor::run(slotRawFloat(a
), slotRawFloat(b
)));
321 if (numArgsPushed
!= -1) // special case flag meaning it is a primitive
322 return errFailed
; // arguments remain on the stack
324 msg
= gSpecialBinarySelectors
[g
->primitiveIndex
];
325 sendMessage(g
, msg
, 2);
329 int prAddNum(VMGlobals
*g
, int numArgsPushed
)
331 return prOpNum
<addNum
>(g
, numArgsPushed
);
334 int prSubNum(VMGlobals
*g
, int numArgsPushed
)
336 return prOpNum
<subNum
>(g
, numArgsPushed
);
339 int prMulNum(VMGlobals
*g
, int numArgsPushed
)
341 return prOpNum
<mulNum
>(g
, numArgsPushed
);
345 int prAddFloat(VMGlobals
*g
, int numArgsPushed
)
347 return prOpFloat
<addNum
>(g
, numArgsPushed
);
350 int prSubFloat(VMGlobals
*g
, int numArgsPushed
)
352 return prOpFloat
<subNum
>(g
, numArgsPushed
);
355 int prMulFloat(VMGlobals
*g
, int numArgsPushed
)
357 return prOpFloat
<mulNum
>(g
, numArgsPushed
);
360 int prAddInt(VMGlobals
*g
, int numArgsPushed
)
362 return prOpInt
<addNum
>(g
, numArgsPushed
);
365 int prSubInt(VMGlobals
*g
, int numArgsPushed
)
367 return prOpInt
<subNum
>(g
, numArgsPushed
);
370 int prMulInt(VMGlobals
*g
, int numArgsPushed
)
372 return prOpInt
<mulNum
>(g
, numArgsPushed
);
378 int prNthPrime(VMGlobals
*g
, int numArgsPushed
);
379 int prNthPrime(VMGlobals
*g
, int numArgsPushed
)
395 int prPrevPrime(VMGlobals
*g
, int numArgsPushed
);
396 int prPrevPrime(VMGlobals
*g
, int numArgsPushed
)
413 int prNextPrime(VMGlobals
*g
, int numArgsPushed
);
414 int prNextPrime(VMGlobals
*g
, int numArgsPushed
)
432 int prIsPrime(VMGlobals
*g
, int numArgsPushed
);
433 int prIsPrime(VMGlobals
*g
, int numArgsPushed
)
442 if (n
== 2) { SetTrue(a
); }
443 else { SetFalse(a
); }
444 } else if (n
<= nthPrime(NUMPRIMES
-1)) {
445 // do a search of the primes table
447 if (i
>= 0) { SetTrue(a
); }
448 else { SetFalse(a
); }
451 sqrtn
= (int)sqrt(static_cast<double>(n
));
453 sqrtn
= (int)sqrt(n
);
455 for (i
=0; i
<NUMPRIMES
; ++i
) {
457 if (n
% p
== 0) { SetFalse(a
); break; }
458 if (p
>= sqrtn
) { SetTrue(a
); break; }
464 int prIndexOfPrime(VMGlobals
*g
, int numArgsPushed
);
465 int prIndexOfPrime(VMGlobals
*g
, int numArgsPushed
)
473 if (n
== 2) { SetInt(a
, 0); }
475 } else if (n
<= nthPrime(NUMPRIMES
-1)) {
489 int prAs32Bits(VMGlobals
*g
, int numArgsPushed
);
490 int prAs32Bits(VMGlobals
*g
, int numArgsPushed
)
493 // return an integer that is a bit pattern for the 32 bit float representation
494 union { float f
; int32 i
; } u
;
495 u
.f
= slotRawFloat(a
);
500 int prHigh32Bits(VMGlobals
*g
, int numArgsPushed
);
501 int prHigh32Bits(VMGlobals
*g
, int numArgsPushed
)
505 #if BYTE_ORDER == BIG_ENDIAN
506 union { struct { uint32 hi
, lo
; } i
; double f
; } du
;
508 union { struct { uint32 lo
, hi
; } i
; double f
; } du
;
511 du
.f
= slotRawFloat(a
);
516 int prLow32Bits(VMGlobals
*g
, int numArgsPushed
);
517 int prLow32Bits(VMGlobals
*g
, int numArgsPushed
)
521 #if BYTE_ORDER == BIG_ENDIAN
522 union { struct { uint32 hi
, lo
; } i
; double f
; } du
;
524 union { struct { uint32 lo
, hi
; } i
; double f
; } du
;
527 du
.f
= slotRawFloat(a
);
532 int prFrom32Bits(VMGlobals
*g
, int numArgsPushed
);
533 int prFrom32Bits(VMGlobals
*g
, int numArgsPushed
)
535 PyrSlot
*a
= g
->sp
- 1;
539 err
= slotIntVal(b
, &word
);
542 union { float f
; int32 i
; } u
;
549 int prFrom64Bits(VMGlobals
*g
, int numArgsPushed
);
550 int prFrom64Bits(VMGlobals
*g
, int numArgsPushed
)
552 PyrSlot
*a
= g
->sp
- 2;
553 PyrSlot
*b
= g
->sp
- 1;
557 err
= slotIntVal(b
, &hi
);
560 err
= slotIntVal(c
, &lo
);
563 #if BYTE_ORDER == BIG_ENDIAN
564 union { struct { uint32 hi
, lo
; } i
; double f
; } du
;
566 union { struct { uint32 lo
, hi
; } i
; double f
; } du
;
575 int mathClipInt(struct VMGlobals
*g
, int numArgsPushed
)
587 } else if (IsSym(c
)) {
589 } else if (IsInt(b
) && IsInt(c
)) {
590 SetRaw(a
, sc_clip(slotRawInt(a
), slotRawInt(b
), slotRawInt(c
)));
592 err
= slotDoubleVal(b
, &lo
);
594 err
= slotDoubleVal(c
, &hi
);
596 SetFloat(a
, sc_clip((double)slotRawInt(a
), lo
, hi
));
601 int mathClipFloat(struct VMGlobals
*g
, int numArgsPushed
)
613 } else if (IsSym(c
)) {
616 err
= slotDoubleVal(b
, &lo
);
618 err
= slotDoubleVal(c
, &hi
);
620 SetRaw(a
, sc_clip(slotRawFloat(a
), lo
, hi
));
625 int mathClipSignal(struct VMGlobals
*g
, int numArgsPushed
)
638 } else if (IsSym(c
)) {
640 } else if (IsSignal(b
) && IsSignal(c
)) {
641 sig
= signal_clip_x(g
, slotRawObject(a
), slotRawObject(b
), slotRawObject(c
));
644 err
= slotFloatVal(b
, &lo
);
646 err
= slotFloatVal(c
, &hi
);
648 sig
= signal_clip_f(g
, slotRawObject(a
), lo
, hi
);
654 int mathWrapInt(struct VMGlobals
*g
, int numArgsPushed
)
665 } else if (IsSym(c
)) {
667 } else if (IsInt(b
) && IsInt(c
)) {
668 SetRaw(a
, sc_mod((int)(slotRawInt(a
) - slotRawInt(b
)), (int)(slotRawInt(c
) - slotRawInt(b
) + 1)) + slotRawInt(b
));
672 err
= slotDoubleVal(b
, &lo
);
674 err
= slotDoubleVal(c
, &hi
);
676 SetFloat(a
, sc_mod(x
- lo
, hi
- lo
) + lo
);
681 int mathWrapFloat(struct VMGlobals
*g
, int numArgsPushed
)
693 } else if (IsSym(c
)) {
696 err
= slotDoubleVal(b
, &lo
);
698 err
= slotDoubleVal(c
, &hi
);
700 SetRaw(a
, sc_mod(slotRawFloat(a
) - lo
, hi
- lo
) + lo
);
705 int mathWrapSignal(struct VMGlobals
*g
, int numArgsPushed
)
718 } else if (IsSym(c
)) {
720 } else if (IsSignal(b
) && IsSignal(c
)) {
721 sig
= signal_wrap_x(g
, slotRawObject(a
), slotRawObject(b
), slotRawObject(c
));
724 err
= slotFloatVal(b
, &lo
);
726 err
= slotFloatVal(c
, &hi
);
728 sig
= signal_wrap_f(g
, slotRawObject(a
), lo
, hi
);
734 int mathFoldInt(struct VMGlobals
*g
, int numArgsPushed
)
745 } else if (IsSym(c
)) {
747 } else if (IsInt(b
) && IsInt(c
)) {
748 SetRaw(a
, sc_fold(slotRawInt(a
), slotRawInt(b
), slotRawInt(c
)));
752 err
= slotDoubleVal(b
, &lo
);
754 err
= slotDoubleVal(c
, &hi
);
756 SetFloat(a
, sc_fold(x
, lo
, hi
));
761 int mathFoldFloat(struct VMGlobals
*g
, int numArgsPushed
)
773 } else if (IsSym(c
)) {
776 err
= slotDoubleVal(b
, &lo
);
778 err
= slotDoubleVal(c
, &hi
);
780 SetRaw(a
, sc_fold(slotRawFloat(a
), lo
, hi
));
785 int mathFoldSignal(struct VMGlobals
*g
, int numArgsPushed
)
798 } else if (IsSym(c
)) {
800 } else if (IsSignal(b
) && IsSignal(c
)) {
801 sig
= signal_fold_x(g
, slotRawObject(a
), slotRawObject(b
), slotRawObject(c
));
804 err
= slotFloatVal(b
, &lo
);
806 err
= slotFloatVal(c
, &hi
);
808 sig
= signal_fold_f(g
, slotRawObject(a
), lo
, hi
);
814 int prSimpleNumberSeries(struct VMGlobals
*g
, int numArgsPushed
)
816 PyrSlot
*a
= g
->sp
- 2;
817 PyrSlot
*b
= g
->sp
- 1;
822 if (IsInt(a
) && (IsInt(b
) || IsNil(b
)) && IsInt(c
)) {
823 int first
, second
, last
, step
;
824 first
= slotRawInt(a
);
825 last
= slotRawInt(c
);
826 second
= IsInt(b
) ? slotRawInt(b
) : (first
< last
? first
+ 1 : first
- 1);
827 step
= second
- first
;
832 size
= ((last
- first
) / step
) + 1;
833 if(size
<1 || size
> INT_MAX_BY_PyrSlot
){
834 post("prSimpleNumberSeries: array size %i exceeds limit (%i)\n", size
, INT_MAX_BY_PyrSlot
);
838 PyrObject
*obj
= newPyrArray(g
->gc
, size
, 0, true);
840 PyrSlot
*slots
= obj
->slots
;
842 // Faster iteration for common case
844 for (int i
=0; i
<size
; ++i
) {
848 for (int i
=0; i
<size
; ++i
) {
849 SetInt(slots
+i
, first
++);
854 for (int i
=0; i
<size
; ++i
) {
855 SetInt(slots
+i
, val
);
861 double first
, second
, last
, step
;
862 err
= slotDoubleVal(a
, &first
);
864 err
= slotDoubleVal(c
, &last
);
866 err
= slotDoubleVal(b
, &second
);
868 if (first
< last
) second
= first
+ 1.;
869 else second
= first
- 1.;
872 step
= second
- first
;
873 size
= (int)floor((last
- first
) / step
+ 0.001) + 1;
874 if(size
<1 || size
> INT_MAX_BY_PyrSlot
){
875 post("prSimpleNumberSeries: array size %i exceeds limit (%i)\n", size
, INT_MAX_BY_PyrSlot
);
878 PyrObject
*obj
= newPyrArray(g
->gc
, size
, 0, true);
880 PyrSlot
*slots
= obj
->slots
;
881 if(first
==0. && step
==1.){
882 // Faster iteration for common case
883 for (long i
=0; i
<size
; ++i
) {
884 SetFloat(slots
+i
, i
);
888 for (long i
=0; i
<size
; ++i
) {
889 val
= first
+ step
* i
;
890 SetFloat(slots
+i
, val
);
901 asFraction {|maxDenominator=100|
902 var mediant, lower, upper, temp;
905 #n, d = this.neg.asFraction(maxDenominator);
909 upper = [1.0, this.reciprocal.floor];
910 lower = [1.0, upper[1]+1.0];
912 lower = [this.floor, 1.0];
913 upper = [lower[0]+1.0, 1.0];
915 mediant = [lower[0] + upper[0], lower[1] + upper[1]];
917 mediant = [lower[0] + upper[0], lower[1] + upper[1]];
919 { (this * mediant[1]) > mediant[0] }
921 if (maxDenominator < mediant[1]) {^upper};
922 d = upper[0] - (this * upper[1]);
923 if (d == 0) {^upper};
925 k = floor(((this * lower[1]) - lower[0]) / d);
927 temp = [lower[0] + (k1 * upper[0]), lower[1] + (k1 * upper[1])];
928 lower = [lower[0] + (k * upper[0]), lower[1] + (k * upper[1])];
931 { (this * mediant[1]) == mediant[0] }
933 if (maxDenominator >= mediant[1]) {^mediant};
934 if (lower[1] < upper[1]) {^lower};
938 if (maxDenominator < mediant[1]) {^lower};
939 d = lower[0] - (this * lower[1]);
940 if (d == 0) {^lower};
942 k = floor(((this * upper[1]) - upper[0]) / d);
944 temp = [(k1 * lower[0]) + upper[0], (k1 * lower[1]) + upper[1]];
945 upper = [(k * lower[0]) + upper[0], (k * lower[1]) + upper[1]];
953 int prAsFraction(struct VMGlobals
*g
, int numArgsPushed
)
955 PyrSlot
*a
= g
->sp
- 2;
956 PyrSlot
*b
= g
->sp
- 1;
959 double mediant_num
, lower_num
, upper_num
, temp_num
;
960 double mediant_den
, lower_den
, upper_den
, temp_den
;
967 err
= slotDoubleVal(a
, &x
);
970 err
= slotIntVal(b
, &maxDenominator
);
973 bool faster
= IsTrue(c
);
975 PyrObject
*obj
= newPyrArray(g
->gc
, 2, 0, true);
977 PyrSlot
*slots
= obj
->slots
;
993 upper_den
= floor(1./x
);
995 lower_den
= upper_den
+ 1.;
997 lower_num
= floor(x
);
999 upper_num
= lower_num
+ 1.;
1004 mediant_num
= lower_num
+ upper_num
;
1005 mediant_den
= lower_den
+ upper_den
;
1006 //post(" md %g %g %g %g %g %g\n", mediant_num, mediant_den, lower_num, lower_den, upper_num, upper_den);
1008 if (x
* mediant_den
> mediant_num
) {
1009 d
= upper_num
- (x
* upper_den
);
1010 if (maxDenominator
< mediant_den
|| fabs(d
) < 1e-5) {
1011 if (neg
) upper_num
= -upper_num
;
1012 SetInt(slots
+0, (int)upper_num
);
1013 SetInt(slots
+1, (int)upper_den
);
1016 lower_num
= mediant_num
;
1017 lower_den
= mediant_den
;
1019 k
= (int)floor(((x
* lower_den
) - lower_num
) / d
);
1022 temp_num
= lower_num
+ (k1
* upper_num
);
1023 temp_den
= lower_den
+ (k1
* upper_den
);
1024 lower_num
= lower_num
+ (k
* upper_num
);
1025 lower_den
= lower_den
+ (k
* upper_den
);
1026 upper_num
= temp_num
;
1027 upper_den
= temp_den
;
1030 } else if (x
* mediant_den
== mediant_num
) {
1031 if (maxDenominator
>= mediant_den
) {
1032 if (neg
) mediant_num
= -mediant_num
;
1033 SetInt(slots
+0, (int)mediant_num
);
1034 SetInt(slots
+1, (int)mediant_den
);
1036 } else if (lower_den
< upper_den
) {
1037 if (neg
) lower_num
= -lower_num
;
1038 SetInt(slots
+0, (int)lower_num
);
1039 SetInt(slots
+1, (int)lower_den
);
1042 if (neg
) upper_num
= -upper_num
;
1043 SetInt(slots
+0, (int)upper_num
);
1044 SetInt(slots
+1, (int)upper_den
);
1048 d
= lower_num
- (x
* lower_den
);
1049 if (maxDenominator
< mediant_den
|| fabs(d
) < 1e-5) {
1050 if (neg
) lower_num
= -lower_num
;
1051 SetInt(slots
+0, (int)lower_num
);
1052 SetInt(slots
+1, (int)lower_den
);
1055 upper_num
= mediant_num
;
1056 upper_den
= mediant_den
;
1058 k
= (int)floor(((x
* upper_den
) - upper_num
) / d
);
1061 temp_num
= (k1
* lower_num
) + upper_num
;
1062 temp_den
= (k1
* lower_den
) + upper_den
;
1063 upper_num
= (k
* lower_num
) + upper_num
;
1064 upper_den
= (k
* lower_den
) + upper_den
;
1065 lower_num
= temp_num
;
1066 lower_den
= temp_den
;
1073 void initMathPrimitives()
1077 base
= nextPrimitiveIndex();
1079 definePrimitive(base
, index
++, "_AddInt", prAddInt
, 2, 0);
1080 definePrimitive(base
, index
++, "_SubInt", prSubInt
, 2, 0);
1081 definePrimitive(base
, index
++, "_MulInt", prMulInt
, 2, 0);
1082 definePrimitive(base
, index
++, "_AddFloat", prAddFloat
, 2, 0);
1083 definePrimitive(base
, index
++, "_SubFloat", prSubFloat
, 2, 0);
1084 definePrimitive(base
, index
++, "_MulFloat", prMulFloat
, 2, 0);
1085 definePrimitive(base
, index
++, "_NthPrime", prNthPrime
, 1, 0);
1086 definePrimitive(base
, index
++, "_PrevPrime", prPrevPrime
, 1, 0);
1087 definePrimitive(base
, index
++, "_NextPrime", prNextPrime
, 1, 0);
1088 definePrimitive(base
, index
++, "_IsPrime", prIsPrime
, 1, 0);
1089 definePrimitive(base
, index
++, "_IndexOfPrime", prIndexOfPrime
, 1, 0);
1090 definePrimitive(base
, index
++, "_As32Bits", prAs32Bits
, 1, 0);
1091 definePrimitive(base
, index
++, "_High32Bits", prHigh32Bits
, 1, 0);
1092 definePrimitive(base
, index
++, "_Low32Bits", prLow32Bits
, 1, 0);
1093 definePrimitive(base
, index
++, "_From32Bits", prFrom32Bits
, 2, 0);
1094 definePrimitive(base
, index
++, "_From64Bits", prFrom64Bits
, 3, 0);
1096 definePrimitive(base
, index
++, "_ClipInt", mathClipInt
, 3, 0);
1097 definePrimitive(base
, index
++, "_ClipFloat", mathClipFloat
, 3, 0);
1098 definePrimitive(base
, index
++, "_ClipSignal", mathClipSignal
, 3, 0);
1099 definePrimitive(base
, index
++, "_WrapInt", mathWrapInt
, 3, 0);
1100 definePrimitive(base
, index
++, "_WrapFloat", mathWrapFloat
, 3, 0);
1101 definePrimitive(base
, index
++, "_WrapSignal", mathWrapSignal
, 3, 0);
1102 definePrimitive(base
, index
++, "_FoldInt", mathFoldInt
, 3, 0);
1103 definePrimitive(base
, index
++, "_FoldFloat", mathFoldFloat
, 3, 0);
1104 definePrimitive(base
, index
++, "_FoldSignal", mathFoldSignal
, 3, 0);
1106 definePrimitive(base
, index
++, "_SimpleNumberSeries", prSimpleNumberSeries
, 3, 0);
1107 definePrimitive(base
, index
++, "_AsFraction", prAsFraction
, 3, 0);