1 ! :folding=indent:collapseFolds=0:
5 ! Copyright (C) 2003, 2004 Slava Pestov.
7 ! Redistribution and use in source and binary forms, with or without
8 ! modification, are permitted provided that the following conditions are met:
10 ! 1. Redistributions of source code must retain the above copyright notice,
11 ! this list of conditions and the following disclaimer.
13 ! 2. Redistributions in binary form must reproduce the above copyright notice,
14 ! this list of conditions and the following disclaimer in the documentation
15 ! and/or other materials provided with the distribution.
17 ! THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
18 ! INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
19 ! FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
20 ! DEVELOPERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 ! SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
22 ! PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
23 ! OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24 ! WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
25 ! OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
26 ! ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 [ "java.lang.Number" "java.lang.Number" ]
36 "factor.math.FactorMath" "add"
37 jinvoke-static ; inline
40 [ "java.lang.Number" "java.lang.Number" ]
41 "factor.math.FactorMath" "subtract"
42 jinvoke-static ; inline
45 [ "java.lang.Number" "java.lang.Number" ]
46 "factor.math.FactorMath" "multiply"
47 jinvoke-static ; inline
50 [ "java.lang.Number" "java.lang.Number" ]
51 "factor.math.FactorMath" "divide"
52 jinvoke-static ; inline
55 #! Truncating division.
56 [ "java.lang.Number" "java.lang.Number" ]
57 "factor.math.FactorMath" "_divide"
58 jinvoke-static ; inline
61 [ "java.lang.Number" "java.lang.Number" ]
62 "factor.math.FactorMath" "mod"
63 jinvoke-static ; inline
65 : /mod ( a b -- a/b a%b )
68 : > ( a b -- boolean )
69 [ "java.lang.Number" "java.lang.Number" ]
70 "factor.math.FactorMath" "greater"
71 jinvoke-static ; inline
73 : >= ( a b -- boolean )
74 [ "java.lang.Number" "java.lang.Number" ]
75 "factor.math.FactorMath" "greaterEqual"
76 jinvoke-static ; inline
78 : < ( a b -- boolean )
79 [ "java.lang.Number" "java.lang.Number" ]
80 "factor.math.FactorMath" "less"
81 jinvoke-static ; inline
83 : <= ( a b -- boolean )
84 [ "java.lang.Number" "java.lang.Number" ]
85 "factor.math.FactorMath" "lessEqual"
86 jinvoke-static ; inline
88 : >=< ( x y obj1 obj2 obj3 -- obj )
89 ! If x > y, pushes obj1, if x = y, pushes obj2, else obj3.
92 "java.lang.Object" "java.lang.Object" "java.lang.Object"
94 "factor.FactorLib" "branch3" jinvoke-static ;
96 : bitand ( x y -- x&y )
98 [ "java.lang.Number" "java.lang.Number" ]
99 "factor.math.FactorMath" "and"
100 jinvoke-static ; inline
102 : bitor ( x y -- x|y )
104 [ "java.lang.Number" "java.lang.Number" ]
105 "factor.math.FactorMath" "or"
106 jinvoke-static ; inline
108 : bitxor ( x y -- x^y )
109 #! Bitwise exclusive or.
110 [ "java.lang.Number" "java.lang.Number" ]
111 "factor.math.FactorMath" "xor"
112 jinvoke-static ; inline
115 #! Bitwise complement.
116 [ "java.lang.Number" ]
117 "factor.math.FactorMath" "not"
118 jinvoke-static ; inline
121 #! Shift 'by' bits to the left.
122 [ "java.lang.Number" "int" ]
123 "factor.math.FactorMath" "shiftLeft"
124 jinvoke-static ; inline
127 #! Shift 'by' bits to the right.
128 [ "java.lang.Number" "int" ]
129 "factor.math.FactorMath" "shiftRight"
130 jinvoke-static ; inline
132 : shift>> ( x by -- )
133 #! Shift 'by' bits to the right, without performing sign
135 [ "java.lang.Number" "int" ]
136 "factor.math.FactorMath" "shiftRightUnsigned"
137 jinvoke-static ; inline
139 : rem ( x y -- remainder )
140 [ "double" "double" ] "java.lang.Math" "IEEEremainder"
141 jinvoke-static ; inline
144 [ "java.lang.Number" "java.lang.Number" ]
145 "factor.math.FactorMath" "gcd" jinvoke-static ;