| 1 | module scheme |
| 2 | |
| 3 | const fixnum_native_descriptors = [ |
| 4 | NativeDescriptor{'fixnum?', arithmetic_fixnum_fixnump}, |
| 5 | NativeDescriptor{'fixnum-width', arithmetic_fixnum_fixnum_width}, |
| 6 | NativeDescriptor{'least-fixnum', arithmetic_fixnum_least_fixnum}, |
| 7 | NativeDescriptor{'greatest-fixnum', arithmetic_fixnum_greatest_fixnum}, |
| 8 | NativeDescriptor{'fx=?', arithmetic_fixnum_eq}, |
| 9 | NativeDescriptor{'fx>?', arithmetic_fixnum_gt}, |
| 10 | NativeDescriptor{'fx<?', arithmetic_fixnum_lt}, |
| 11 | NativeDescriptor{'fx>=?', arithmetic_fixnum_ge}, |
| 12 | NativeDescriptor{'fx<=?', arithmetic_fixnum_le}, |
| 13 | NativeDescriptor{'fxzero?', arithmetic_fixnum_zerop}, |
| 14 | NativeDescriptor{'fxpositive?', arithmetic_fixnum_positivep}, |
| 15 | NativeDescriptor{'fxnegative?', arithmetic_fixnum_negativep}, |
| 16 | NativeDescriptor{'fxodd?', arithmetic_fixnum_oddp}, |
| 17 | NativeDescriptor{'fxeven?', arithmetic_fixnum_evenp}, |
| 18 | NativeDescriptor{'fxmax', arithmetic_fixnum_max}, |
| 19 | NativeDescriptor{'fxmin', arithmetic_fixnum_min}, |
| 20 | NativeDescriptor{'fx+', arithmetic_fixnum_add}, |
| 21 | NativeDescriptor{'fx*', arithmetic_fixnum_multiply}, |
| 22 | NativeDescriptor{'fx-', arithmetic_fixnum_subtract}, |
| 23 | NativeDescriptor{'fxdiv-and-mod', arithmetic_fixnum_div_and_mod}, |
| 24 | NativeDescriptor{'fxdiv', arithmetic_fixnum_div}, |
| 25 | NativeDescriptor{'fxmod', arithmetic_fixnum_mod}, |
| 26 | NativeDescriptor{'fxdiv0-and-mod0', arithmetic_fixnum_div0_and_mod0}, |
| 27 | NativeDescriptor{'fxdiv0', arithmetic_fixnum_div0}, |
| 28 | NativeDescriptor{'fxmod0', arithmetic_fixnum_mod0}, |
| 29 | NativeDescriptor{'fx+/carry', arithmetic_fixnum_add_carry}, |
| 30 | NativeDescriptor{'fx-/carry', arithmetic_fixnum_subtract_carry}, |
| 31 | NativeDescriptor{'fx*/carry', arithmetic_fixnum_multiply_carry}, |
| 32 | NativeDescriptor{'fxnot', arithmetic_fixnum_complement}, |
| 33 | NativeDescriptor{'fxand', arithmetic_fixnum_band}, |
| 34 | NativeDescriptor{'fxior', arithmetic_fixnum_bor}, |
| 35 | NativeDescriptor{'fxxor', arithmetic_fixnum_bxor}, |
| 36 | NativeDescriptor{'fxif', arithmetic_fixnum_select}, |
| 37 | NativeDescriptor{'fxbit-count', arithmetic_fixnum_bit_count}, |
| 38 | NativeDescriptor{'fxlength', arithmetic_fixnum_length}, |
| 39 | NativeDescriptor{'fxfirst-bit-set', arithmetic_fixnum_first_bit_set}, |
| 40 | NativeDescriptor{'fxbit-set?', arithmetic_fixnum_bit_setp}, |
| 41 | NativeDescriptor{'fxcopy-bit', arithmetic_fixnum_copy_bit}, |
| 42 | NativeDescriptor{'fxbit-field', arithmetic_fixnum_bit_field}, |
| 43 | NativeDescriptor{'fxcopy-bit-field', arithmetic_fixnum_copy_bit_field}, |
| 44 | NativeDescriptor{'fxarithmetic-shift', arithmetic_fixnum_arithmetic_shift}, |
| 45 | NativeDescriptor{'fxarithmetic-shift-left', arithmetic_fixnum_arithmetic_shift_left}, |
| 46 | NativeDescriptor{'fxarithmetic-shift-right', arithmetic_fixnum_arithmetic_shift_right}, |
| 47 | NativeDescriptor{'fxrotate-bit-field', arithmetic_fixnum_rotate_bit_field}, |
| 48 | NativeDescriptor{'fxreverse-bit-field', arithmetic_fixnum_reverse_bit_field}, |
| 49 | ]! |
| 50 | |
| 51 | enum FixnumOperation { |
| 52 | fixnump |
| 53 | fixnum_width |
| 54 | least_fixnum |
| 55 | greatest_fixnum |
| 56 | eq |
| 57 | gt |
| 58 | lt |
| 59 | ge |
| 60 | le |
| 61 | zerop |
| 62 | positivep |
| 63 | negativep |
| 64 | oddp |
| 65 | evenp |
| 66 | max |
| 67 | min |
| 68 | add |
| 69 | multiply |
| 70 | subtract |
| 71 | div_and_mod |
| 72 | div |
| 73 | mod |
| 74 | div0_and_mod0 |
| 75 | div0 |
| 76 | mod0 |
| 77 | add_carry |
| 78 | subtract_carry |
| 79 | multiply_carry |
| 80 | complement |
| 81 | band |
| 82 | bor |
| 83 | bxor |
| 84 | select |
| 85 | bit_count |
| 86 | length |
| 87 | first_bit_set |
| 88 | bit_setp |
| 89 | copy_bit |
| 90 | bit_field |
| 91 | copy_bit_field |
| 92 | arithmetic_shift |
| 93 | arithmetic_shift_left |
| 94 | arithmetic_shift_right |
| 95 | rotate_bit_field |
| 96 | reverse_bit_field |
| 97 | } |
| 98 | |
| 99 | fn arithmetic_fixnum_fixnump(mut _vm VM, args []Value) !Value { return fixnum_call(.fixnump, args) } |
| 100 | |
| 101 | fn arithmetic_fixnum_fixnum_width(mut _vm VM, args []Value) !Value { |
| 102 | return fixnum_call(.fixnum_width, args) |
| 103 | } |
| 104 | |
| 105 | fn arithmetic_fixnum_least_fixnum(mut _vm VM, args []Value) !Value { |
| 106 | return fixnum_call(.least_fixnum, args) |
| 107 | } |
| 108 | |
| 109 | fn arithmetic_fixnum_greatest_fixnum(mut _vm VM, args []Value) !Value { |
| 110 | return fixnum_call(.greatest_fixnum, args) |
| 111 | } |
| 112 | |
| 113 | fn arithmetic_fixnum_eq(mut _vm VM, args []Value) !Value { return fixnum_call(.eq, args) } |
| 114 | |
| 115 | fn arithmetic_fixnum_gt(mut _vm VM, args []Value) !Value { return fixnum_call(.gt, args) } |
| 116 | |
| 117 | fn arithmetic_fixnum_lt(mut _vm VM, args []Value) !Value { return fixnum_call(.lt, args) } |
| 118 | |
| 119 | fn arithmetic_fixnum_ge(mut _vm VM, args []Value) !Value { return fixnum_call(.ge, args) } |
| 120 | |
| 121 | fn arithmetic_fixnum_le(mut _vm VM, args []Value) !Value { return fixnum_call(.le, args) } |
| 122 | |
| 123 | fn arithmetic_fixnum_zerop(mut _vm VM, args []Value) !Value { return fixnum_call(.zerop, args) } |
| 124 | |
| 125 | fn arithmetic_fixnum_positivep(mut _vm VM, args []Value) !Value { |
| 126 | return fixnum_call(.positivep, args) |
| 127 | } |
| 128 | |
| 129 | fn arithmetic_fixnum_negativep(mut _vm VM, args []Value) !Value { |
| 130 | return fixnum_call(.negativep, args) |
| 131 | } |
| 132 | |
| 133 | fn arithmetic_fixnum_oddp(mut _vm VM, args []Value) !Value { return fixnum_call(.oddp, args) } |
| 134 | |
| 135 | fn arithmetic_fixnum_evenp(mut _vm VM, args []Value) !Value { return fixnum_call(.evenp, args) } |
| 136 | |
| 137 | fn arithmetic_fixnum_max(mut _vm VM, args []Value) !Value { return fixnum_call(.max, args) } |
| 138 | |
| 139 | fn arithmetic_fixnum_min(mut _vm VM, args []Value) !Value { return fixnum_call(.min, args) } |
| 140 | |
| 141 | fn arithmetic_fixnum_add(mut _vm VM, args []Value) !Value { return fixnum_call(.add, args) } |
| 142 | |
| 143 | fn arithmetic_fixnum_multiply(mut _vm VM, args []Value) !Value { |
| 144 | return fixnum_call(.multiply, args) |
| 145 | } |
| 146 | |
| 147 | fn arithmetic_fixnum_subtract(mut _vm VM, args []Value) !Value { |
| 148 | return fixnum_call(.subtract, args) |
| 149 | } |
| 150 | |
| 151 | fn arithmetic_fixnum_div_and_mod(mut _vm VM, args []Value) !Value { |
| 152 | return fixnum_call(.div_and_mod, args) |
| 153 | } |
| 154 | |
| 155 | fn arithmetic_fixnum_div(mut _vm VM, args []Value) !Value { return fixnum_call(.div, args) } |
| 156 | |
| 157 | fn arithmetic_fixnum_mod(mut _vm VM, args []Value) !Value { return fixnum_call(.mod, args) } |
| 158 | |
| 159 | fn arithmetic_fixnum_div0_and_mod0(mut _vm VM, args []Value) !Value { |
| 160 | return fixnum_call(.div0_and_mod0, args) |
| 161 | } |
| 162 | |
| 163 | fn arithmetic_fixnum_div0(mut _vm VM, args []Value) !Value { return fixnum_call(.div0, args) } |
| 164 | |
| 165 | fn arithmetic_fixnum_mod0(mut _vm VM, args []Value) !Value { return fixnum_call(.mod0, args) } |
| 166 | |
| 167 | fn arithmetic_fixnum_add_carry(mut _vm VM, args []Value) !Value { |
| 168 | return fixnum_call(.add_carry, args) |
| 169 | } |
| 170 | |
| 171 | fn arithmetic_fixnum_subtract_carry(mut _vm VM, args []Value) !Value { |
| 172 | return fixnum_call(.subtract_carry, args) |
| 173 | } |
| 174 | |
| 175 | fn arithmetic_fixnum_multiply_carry(mut _vm VM, args []Value) !Value { |
| 176 | return fixnum_call(.multiply_carry, args) |
| 177 | } |
| 178 | |
| 179 | fn arithmetic_fixnum_complement(mut _vm VM, args []Value) !Value { |
| 180 | return fixnum_call(.complement, args) |
| 181 | } |
| 182 | |
| 183 | fn arithmetic_fixnum_band(mut _vm VM, args []Value) !Value { return fixnum_call(.band, args) } |
| 184 | |
| 185 | fn arithmetic_fixnum_bor(mut _vm VM, args []Value) !Value { return fixnum_call(.bor, args) } |
| 186 | |
| 187 | fn arithmetic_fixnum_bxor(mut _vm VM, args []Value) !Value { return fixnum_call(.bxor, args) } |
| 188 | |
| 189 | fn arithmetic_fixnum_select(mut _vm VM, args []Value) !Value { return fixnum_call(.select, args) } |
| 190 | |
| 191 | fn arithmetic_fixnum_bit_count(mut _vm VM, args []Value) !Value { |
| 192 | return fixnum_call(.bit_count, args) |
| 193 | } |
| 194 | |
| 195 | fn arithmetic_fixnum_length(mut _vm VM, args []Value) !Value { return fixnum_call(.length, args) } |
| 196 | |
| 197 | fn arithmetic_fixnum_first_bit_set(mut _vm VM, args []Value) !Value { |
| 198 | return fixnum_call(.first_bit_set, args) |
| 199 | } |
| 200 | |
| 201 | fn arithmetic_fixnum_bit_setp(mut _vm VM, args []Value) !Value { |
| 202 | return fixnum_call(.bit_setp, args) |
| 203 | } |
| 204 | |
| 205 | fn arithmetic_fixnum_copy_bit(mut _vm VM, args []Value) !Value { |
| 206 | return fixnum_call(.copy_bit, args) |
| 207 | } |
| 208 | |
| 209 | fn arithmetic_fixnum_bit_field(mut _vm VM, args []Value) !Value { |
| 210 | return fixnum_call(.bit_field, args) |
| 211 | } |
| 212 | |
| 213 | fn arithmetic_fixnum_copy_bit_field(mut _vm VM, args []Value) !Value { |
| 214 | return fixnum_call(.copy_bit_field, args) |
| 215 | } |
| 216 | |
| 217 | fn arithmetic_fixnum_arithmetic_shift(mut _vm VM, args []Value) !Value { |
| 218 | return fixnum_call(.arithmetic_shift, args) |
| 219 | } |
| 220 | |
| 221 | fn arithmetic_fixnum_arithmetic_shift_left(mut _vm VM, args []Value) !Value { |
| 222 | return fixnum_call(.arithmetic_shift_left, args) |
| 223 | } |
| 224 | |
| 225 | fn arithmetic_fixnum_arithmetic_shift_right(mut _vm VM, args []Value) !Value { |
| 226 | return fixnum_call(.arithmetic_shift_right, args) |
| 227 | } |
| 228 | |
| 229 | fn arithmetic_fixnum_rotate_bit_field(mut _vm VM, args []Value) !Value { |
| 230 | return fixnum_call(.rotate_bit_field, args) |
| 231 | } |
| 232 | |
| 233 | fn arithmetic_fixnum_reverse_bit_field(mut _vm VM, args []Value) !Value { |
| 234 | return fixnum_call(.reverse_bit_field, args) |
| 235 | } |
| 236 | |