numo-narray-alt 0.9.14 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,496 @@
1
+ #ifndef NUMO_NARRAY_MH_STORE_H
2
+ #define NUMO_NARRAY_MH_STORE_H 1
3
+
4
+ #define DEF_STORE_NUMERIC_FUNC(tDType, tNAryClass) \
5
+ static VALUE tDType##_store(VALUE, VALUE); \
6
+ \
7
+ static VALUE tDType##_new_dim0(tDType x) { \
8
+ VALUE v = nary_new(tNAryClass, 0, NULL); \
9
+ tDType* ptr = (tDType*)(char*)na_get_pointer_for_write(v); \
10
+ *ptr = x; \
11
+ na_release_lock(v); \
12
+ return v; \
13
+ } \
14
+ \
15
+ static VALUE tDType##_store_numeric(VALUE self, VALUE obj) { \
16
+ tDType x = m_num_to_data(obj); \
17
+ obj = tDType##_new_dim0(x); \
18
+ tDType##_store(self, obj); \
19
+ return self; \
20
+ }
21
+
22
+ #define DEF_STORE_BIT_FUNC(tDType) \
23
+ static void iter_##tDType##_store_bit(na_loop_t* const lp) { \
24
+ size_t n; \
25
+ char* p1; \
26
+ size_t p2; \
27
+ ssize_t s1; \
28
+ ssize_t s2; \
29
+ size_t* idx1; \
30
+ size_t* idx2; \
31
+ BIT_DIGIT* a2; \
32
+ BIT_DIGIT x; \
33
+ tDType y; \
34
+ INIT_COUNTER(lp, n); \
35
+ INIT_PTR_IDX(lp, 0, p1, s1, idx1); \
36
+ INIT_PTR_BIT_IDX(lp, 1, a2, p2, s2, idx2); \
37
+ if (idx2) { \
38
+ if (idx1) { \
39
+ for (size_t i = 0; i < n; i++) { \
40
+ LOAD_BIT(a2, p2 + *idx2, x); \
41
+ idx2++; \
42
+ y = m_from_sint(x); \
43
+ SET_DATA_INDEX(p1, idx1, dtype, y); \
44
+ } \
45
+ } else { \
46
+ for (size_t i = 0; i < n; i++) { \
47
+ LOAD_BIT(a2, p2 + *idx2, x); \
48
+ idx2++; \
49
+ y = m_from_sint(x); \
50
+ SET_DATA_STRIDE(p1, s1, dtype, y); \
51
+ } \
52
+ } \
53
+ } else { \
54
+ if (idx1) { \
55
+ for (size_t i = 0; i < n; i++) { \
56
+ LOAD_BIT(a2, p2, x); \
57
+ p2 += s2; \
58
+ y = m_from_sint(x); \
59
+ SET_DATA_INDEX(p1, idx1, dtype, y); \
60
+ } \
61
+ } else { \
62
+ for (size_t i = 0; i < n; i++) { \
63
+ LOAD_BIT(a2, p2, x); \
64
+ p2 += s2; \
65
+ y = m_from_sint(x); \
66
+ SET_DATA_STRIDE(p1, s1, dtype, y); \
67
+ } \
68
+ } \
69
+ } \
70
+ } \
71
+ \
72
+ static VALUE tDType##_store_bit(VALUE self, VALUE obj) { \
73
+ ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } }; \
74
+ ndfunc_t ndf = { iter_##tDType##_store_bit, FULL_LOOP, 2, 0, ain, 0 }; \
75
+ na_ndloop(&ndf, 2, self, obj); \
76
+ return self; \
77
+ }
78
+
79
+ #define DEF_STORE_DTYPE_FUNC(tDType, tFrmDType, tFrmPType, mFrmFunc) \
80
+ static void iter_##tDType##_store_##tFrmDType(na_loop_t* const lp) { \
81
+ size_t n; \
82
+ size_t s1; \
83
+ size_t s2; \
84
+ char* p1; \
85
+ char* p2; \
86
+ size_t* idx1; \
87
+ size_t* idx2; \
88
+ tFrmPType x; \
89
+ tDType y; \
90
+ INIT_COUNTER(lp, n); \
91
+ INIT_PTR_IDX(lp, 0, p1, s1, idx1); \
92
+ INIT_PTR_IDX(lp, 1, p2, s2, idx2); \
93
+ if (idx2) { \
94
+ if (idx1) { \
95
+ for (size_t i = 0; i < n; i++) { \
96
+ GET_DATA_INDEX(p2, idx2, tFrmPType, x); \
97
+ y = (tDType)mFrmFunc(x); \
98
+ SET_DATA_INDEX(p1, idx1, tDType, y); \
99
+ } \
100
+ } else { \
101
+ for (size_t i = 0; i < n; i++) { \
102
+ GET_DATA_INDEX(p2, idx2, tFrmPType, x); \
103
+ y = (tDType)mFrmFunc(x); \
104
+ SET_DATA_STRIDE(p1, s1, tDType, y); \
105
+ } \
106
+ } \
107
+ } else { \
108
+ if (idx1) { \
109
+ for (size_t i = 0; i < n; i++) { \
110
+ GET_DATA_STRIDE(p2, s2, tFrmPType, x); \
111
+ y = (tDType)mFrmFunc(x); \
112
+ SET_DATA_INDEX(p1, idx1, tDType, y); \
113
+ } \
114
+ } else { \
115
+ for (size_t i = 0; i < n; i++) { \
116
+ GET_DATA_STRIDE(p2, s2, tFrmPType, x); \
117
+ y = (tDType)mFrmFunc(x); \
118
+ SET_DATA_STRIDE(p1, s1, tDType, y); \
119
+ } \
120
+ } \
121
+ } \
122
+ } \
123
+ \
124
+ static VALUE tDType##_store_##tFrmDType(VALUE self, VALUE obj) { \
125
+ ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { Qnil, 0 } }; \
126
+ ndfunc_t ndf = { iter_##tDType##_store_##tFrmDType, FULL_LOOP, 2, 0, ain, 0 }; \
127
+ na_ndloop(&ndf, 2, self, obj); \
128
+ return self; \
129
+ }
130
+
131
+ #define DEF_STORE_ARRAY_FUNC(tDType) \
132
+ static void iter_##tDType##_store_array(na_loop_t* const lp) { \
133
+ size_t i; \
134
+ size_t i1; \
135
+ size_t n1; \
136
+ VALUE v1; \
137
+ VALUE* ptr; \
138
+ VALUE x; \
139
+ double y; \
140
+ tDType z; \
141
+ size_t len; \
142
+ size_t c; \
143
+ double beg; \
144
+ double step; \
145
+ size_t n; \
146
+ char* p1; \
147
+ size_t s1; \
148
+ size_t* idx1; \
149
+ INIT_COUNTER(lp, n); \
150
+ INIT_PTR_IDX(lp, 0, p1, s1, idx1); \
151
+ v1 = lp->args[1].value; \
152
+ i = 0; \
153
+ if (lp->args[1].ptr) { \
154
+ if (v1 == Qtrue) { \
155
+ iter_##tDType##_store_##tDType(lp); \
156
+ i = lp->args[1].shape[0]; \
157
+ if (idx1) { \
158
+ idx1 += i; \
159
+ } else { \
160
+ p1 += s1 * i; \
161
+ } \
162
+ } \
163
+ goto loop_end; \
164
+ } \
165
+ ptr = &v1; \
166
+ switch (TYPE(v1)) { \
167
+ case T_ARRAY: \
168
+ n1 = RARRAY_LEN(v1); \
169
+ ptr = RARRAY_PTR(v1); \
170
+ break; \
171
+ case T_NIL: \
172
+ n1 = 0; \
173
+ break; \
174
+ default: \
175
+ n1 = 1; \
176
+ } \
177
+ if (idx1) { \
178
+ for (i = i1 = 0; i1 < n1 && i < n; i++, i1++) { \
179
+ x = ptr[i1]; \
180
+ if (rb_obj_is_kind_of(x, rb_cRange) || rb_obj_is_kind_of(x, rb_cArithSeq)) { \
181
+ nary_step_sequence(x, &len, &beg, &step); \
182
+ for (c = 0; c < len && i < n; c++, i++) { \
183
+ y = beg + step * c; \
184
+ z = m_from_double(y); \
185
+ SET_DATA_INDEX(p1, idx1, tDType, z); \
186
+ } \
187
+ } else if (TYPE(x) != T_ARRAY) { \
188
+ z = m_num_to_data(x); \
189
+ SET_DATA_INDEX(p1, idx1, tDType, z); \
190
+ } \
191
+ } \
192
+ } else { \
193
+ for (i = i1 = 0; i1 < n1 && i < n; i++, i1++) { \
194
+ x = ptr[i1]; \
195
+ if (rb_obj_is_kind_of(x, rb_cRange) || rb_obj_is_kind_of(x, rb_cArithSeq)) { \
196
+ nary_step_sequence(x, &len, &beg, &step); \
197
+ for (c = 0; c < len && i < n; c++, i++) { \
198
+ y = beg + step * c; \
199
+ z = m_from_double(y); \
200
+ SET_DATA_STRIDE(p1, s1, tDType, z); \
201
+ } \
202
+ } else if (TYPE(x) != T_ARRAY) { \
203
+ z = m_num_to_data(x); \
204
+ SET_DATA_STRIDE(p1, s1, tDType, z); \
205
+ } \
206
+ } \
207
+ } \
208
+ loop_end: \
209
+ z = m_zero; \
210
+ if (idx1) { \
211
+ for (; i < n; i++) { \
212
+ SET_DATA_INDEX(p1, idx1, tDType, z); \
213
+ } \
214
+ } else { \
215
+ for (; i < n; i++) { \
216
+ SET_DATA_STRIDE(p1, s1, tDType, z); \
217
+ } \
218
+ } \
219
+ } \
220
+ \
221
+ static VALUE tDType##_store_array(VALUE self, VALUE rary) { \
222
+ ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { rb_cArray, 0 } }; \
223
+ ndfunc_t ndf = { iter_##tDType##_store_array, FULL_LOOP, 2, 0, ain, 0 }; \
224
+ na_ndloop_store_rarray(&ndf, self, rary); \
225
+ return self; \
226
+ }
227
+
228
+ #define DEF_NARRAY_STORE_METHOD_FUNC(tDType, tNAryClass) \
229
+ DEF_STORE_NUMERIC_FUNC(tDType, tNAryClass) \
230
+ DEF_STORE_BIT_FUNC(tDType) \
231
+ DEF_STORE_DTYPE_FUNC(tDType, dfloat, double, m_from_real) \
232
+ DEF_STORE_DTYPE_FUNC(tDType, sfloat, float, m_from_real) \
233
+ DEF_STORE_DTYPE_FUNC(tDType, int64, int64_t, m_from_int64) \
234
+ DEF_STORE_DTYPE_FUNC(tDType, int32, int32_t, m_from_int32) \
235
+ DEF_STORE_DTYPE_FUNC(tDType, int16, int16_t, m_from_sint) \
236
+ DEF_STORE_DTYPE_FUNC(tDType, int8, int8_t, m_from_sint) \
237
+ DEF_STORE_DTYPE_FUNC(tDType, uint64, u_int64_t, m_from_uint64) \
238
+ DEF_STORE_DTYPE_FUNC(tDType, uint32, u_int32_t, m_from_uint32) \
239
+ DEF_STORE_DTYPE_FUNC(tDType, uint16, u_int16_t, m_from_sint) \
240
+ DEF_STORE_DTYPE_FUNC(tDType, uint8, u_int8_t, m_from_sint) \
241
+ DEF_STORE_DTYPE_FUNC(tDType, robject, VALUE, m_num_to_data) \
242
+ DEF_STORE_ARRAY_FUNC(tDType) \
243
+ static VALUE tDType##_store(VALUE self, VALUE obj) { \
244
+ VALUE klass = rb_obj_class(obj); \
245
+ if (IS_INTEGER_CLASS(klass) || klass == rb_cFloat || klass == rb_cComplex) { \
246
+ tDType##_store_numeric(self, obj); \
247
+ return self; \
248
+ } \
249
+ if (klass == numo_cBit) { \
250
+ tDType##_store_bit(self, obj); \
251
+ return self; \
252
+ } \
253
+ if (klass == numo_cDFloat) { \
254
+ tDType##_store_dfloat(self, obj); \
255
+ return self; \
256
+ } \
257
+ if (klass == numo_cSFloat) { \
258
+ tDType##_store_sfloat(self, obj); \
259
+ return self; \
260
+ } \
261
+ if (klass == numo_cInt64) { \
262
+ tDType##_store_int64(self, obj); \
263
+ return self; \
264
+ } \
265
+ if (klass == numo_cInt32) { \
266
+ tDType##_store_int32(self, obj); \
267
+ return self; \
268
+ } \
269
+ if (klass == numo_cInt16) { \
270
+ tDType##_store_int16(self, obj); \
271
+ return self; \
272
+ } \
273
+ if (klass == numo_cInt8) { \
274
+ tDType##_store_int8(self, obj); \
275
+ return self; \
276
+ } \
277
+ if (klass == numo_cUInt64) { \
278
+ tDType##_store_uint64(self, obj); \
279
+ return self; \
280
+ } \
281
+ if (klass == numo_cUInt32) { \
282
+ tDType##_store_uint32(self, obj); \
283
+ return self; \
284
+ } \
285
+ if (klass == numo_cUInt16) { \
286
+ tDType##_store_uint16(self, obj); \
287
+ return self; \
288
+ } \
289
+ if (klass == numo_cUInt8) { \
290
+ tDType##_store_uint8(self, obj); \
291
+ return self; \
292
+ } \
293
+ if (klass == numo_cRObject) { \
294
+ tDType##_store_robject(self, obj); \
295
+ return self; \
296
+ } \
297
+ if (klass == rb_cArray) { \
298
+ tDType##_store_array(self, obj); \
299
+ return self; \
300
+ } \
301
+ if (IsNArray(obj)) { \
302
+ VALUE r = rb_funcall(obj, rb_intern("coerce_cast"), 1, tNAryClass); \
303
+ if (rb_obj_class(r) == tNAryClass) { \
304
+ tDType##_store(self, r); \
305
+ return self; \
306
+ } \
307
+ } \
308
+ rb_raise( \
309
+ nary_eCastError, "unknown conversion from %s to %s", rb_class2name(rb_obj_class(obj)), \
310
+ rb_class2name(rb_obj_class(self)) \
311
+ ); \
312
+ return self; \
313
+ }
314
+
315
+ #define DEF_NARRAY_CMP_STORE_METHOD_FUNC(tDType, tNAryClass) \
316
+ DEF_STORE_NUMERIC_FUNC(tDType, tNAryClass) \
317
+ DEF_STORE_BIT_FUNC(tDType) \
318
+ DEF_STORE_DTYPE_FUNC(tDType, dcomplex, dcomplex, m_from_dcomplex) \
319
+ DEF_STORE_DTYPE_FUNC(tDType, scomplex, scomplex, m_from_scomplex) \
320
+ DEF_STORE_DTYPE_FUNC(tDType, dfloat, double, m_from_real) \
321
+ DEF_STORE_DTYPE_FUNC(tDType, sfloat, float, m_from_real) \
322
+ DEF_STORE_DTYPE_FUNC(tDType, int64, int64_t, m_from_int64) \
323
+ DEF_STORE_DTYPE_FUNC(tDType, int32, int32_t, m_from_int32) \
324
+ DEF_STORE_DTYPE_FUNC(tDType, int16, int16_t, m_from_sint) \
325
+ DEF_STORE_DTYPE_FUNC(tDType, int8, int8_t, m_from_sint) \
326
+ DEF_STORE_DTYPE_FUNC(tDType, uint64, u_int64_t, m_from_uint64) \
327
+ DEF_STORE_DTYPE_FUNC(tDType, uint32, u_int32_t, m_from_uint32) \
328
+ DEF_STORE_DTYPE_FUNC(tDType, uint16, u_int16_t, m_from_sint) \
329
+ DEF_STORE_DTYPE_FUNC(tDType, uint8, u_int8_t, m_from_sint) \
330
+ DEF_STORE_DTYPE_FUNC(tDType, robject, VALUE, m_num_to_data) \
331
+ DEF_STORE_ARRAY_FUNC(tDType) \
332
+ static VALUE tDType##_store(VALUE self, VALUE obj) { \
333
+ VALUE klass = rb_obj_class(obj); \
334
+ if (IS_INTEGER_CLASS(klass) || klass == rb_cFloat || klass == rb_cComplex) { \
335
+ tDType##_store_numeric(self, obj); \
336
+ return self; \
337
+ } \
338
+ if (klass == numo_cBit) { \
339
+ tDType##_store_bit(self, obj); \
340
+ return self; \
341
+ } \
342
+ if (klass == numo_cDComplex) { \
343
+ tDType##_store_dcomplex(self, obj); \
344
+ return self; \
345
+ } \
346
+ if (klass == numo_cSComplex) { \
347
+ tDType##_store_scomplex(self, obj); \
348
+ return self; \
349
+ } \
350
+ if (klass == numo_cDFloat) { \
351
+ tDType##_store_dfloat(self, obj); \
352
+ return self; \
353
+ } \
354
+ if (klass == numo_cSFloat) { \
355
+ tDType##_store_sfloat(self, obj); \
356
+ return self; \
357
+ } \
358
+ if (klass == numo_cInt64) { \
359
+ tDType##_store_int64(self, obj); \
360
+ return self; \
361
+ } \
362
+ if (klass == numo_cInt32) { \
363
+ tDType##_store_int32(self, obj); \
364
+ return self; \
365
+ } \
366
+ if (klass == numo_cInt16) { \
367
+ tDType##_store_int16(self, obj); \
368
+ return self; \
369
+ } \
370
+ if (klass == numo_cInt8) { \
371
+ tDType##_store_int8(self, obj); \
372
+ return self; \
373
+ } \
374
+ if (klass == numo_cUInt64) { \
375
+ tDType##_store_uint64(self, obj); \
376
+ return self; \
377
+ } \
378
+ if (klass == numo_cUInt32) { \
379
+ tDType##_store_uint32(self, obj); \
380
+ return self; \
381
+ } \
382
+ if (klass == numo_cUInt16) { \
383
+ tDType##_store_uint16(self, obj); \
384
+ return self; \
385
+ } \
386
+ if (klass == numo_cUInt8) { \
387
+ tDType##_store_uint8(self, obj); \
388
+ return self; \
389
+ } \
390
+ if (klass == numo_cRObject) { \
391
+ tDType##_store_robject(self, obj); \
392
+ return self; \
393
+ } \
394
+ if (klass == rb_cArray) { \
395
+ tDType##_store_array(self, obj); \
396
+ return self; \
397
+ } \
398
+ if (IsNArray(obj)) { \
399
+ VALUE r = rb_funcall(obj, rb_intern("coerce_cast"), 1, tNAryClass); \
400
+ if (rb_obj_class(r) == tNAryClass) { \
401
+ tDType##_store(self, r); \
402
+ return self; \
403
+ } \
404
+ } \
405
+ rb_raise( \
406
+ nary_eCastError, "unknown conversion from %s to %s", rb_class2name(rb_obj_class(obj)), \
407
+ rb_class2name(rb_obj_class(self)) \
408
+ ); \
409
+ return self; \
410
+ }
411
+
412
+ #define DEF_NARRAY_ROBJ_STORE_METHOD_FUNC() \
413
+ DEF_STORE_NUMERIC_FUNC(robject, numo_cRObject) \
414
+ DEF_STORE_BIT_FUNC(robject) \
415
+ DEF_STORE_DTYPE_FUNC(robject, dfloat, double, m_from_real) \
416
+ DEF_STORE_DTYPE_FUNC(robject, sfloat, float, m_from_real) \
417
+ DEF_STORE_DTYPE_FUNC(robject, int64, int64_t, m_from_int64) \
418
+ DEF_STORE_DTYPE_FUNC(robject, int32, int32_t, m_from_int32) \
419
+ DEF_STORE_DTYPE_FUNC(robject, int16, int16_t, m_from_sint) \
420
+ DEF_STORE_DTYPE_FUNC(robject, int8, int8_t, m_from_sint) \
421
+ DEF_STORE_DTYPE_FUNC(robject, uint64, u_int64_t, m_from_uint64) \
422
+ DEF_STORE_DTYPE_FUNC(robject, uint32, u_int32_t, m_from_uint32) \
423
+ DEF_STORE_DTYPE_FUNC(robject, uint16, u_int16_t, m_from_sint) \
424
+ DEF_STORE_DTYPE_FUNC(robject, uint8, u_int8_t, m_from_sint) \
425
+ DEF_STORE_DTYPE_FUNC(robject, robject, VALUE, m_num_to_data) \
426
+ DEF_STORE_ARRAY_FUNC(robject) \
427
+ static VALUE robject_store(VALUE self, VALUE obj) { \
428
+ VALUE klass = rb_obj_class(obj); \
429
+ if (IS_INTEGER_CLASS(klass) || klass == rb_cFloat || klass == rb_cComplex) { \
430
+ robject_store_numeric(self, obj); \
431
+ return self; \
432
+ } \
433
+ if (klass == numo_cBit) { \
434
+ robject_store_bit(self, obj); \
435
+ return self; \
436
+ } \
437
+ if (klass == numo_cDFloat) { \
438
+ robject_store_dfloat(self, obj); \
439
+ return self; \
440
+ } \
441
+ if (klass == numo_cSFloat) { \
442
+ robject_store_sfloat(self, obj); \
443
+ return self; \
444
+ } \
445
+ if (klass == numo_cInt64) { \
446
+ robject_store_int64(self, obj); \
447
+ return self; \
448
+ } \
449
+ if (klass == numo_cInt32) { \
450
+ robject_store_int32(self, obj); \
451
+ return self; \
452
+ } \
453
+ if (klass == numo_cInt16) { \
454
+ robject_store_int16(self, obj); \
455
+ return self; \
456
+ } \
457
+ if (klass == numo_cInt8) { \
458
+ robject_store_int8(self, obj); \
459
+ return self; \
460
+ } \
461
+ if (klass == numo_cUInt64) { \
462
+ robject_store_uint64(self, obj); \
463
+ return self; \
464
+ } \
465
+ if (klass == numo_cUInt32) { \
466
+ robject_store_uint32(self, obj); \
467
+ return self; \
468
+ } \
469
+ if (klass == numo_cUInt16) { \
470
+ robject_store_uint16(self, obj); \
471
+ return self; \
472
+ } \
473
+ if (klass == numo_cUInt8) { \
474
+ robject_store_uint8(self, obj); \
475
+ return self; \
476
+ } \
477
+ if (klass == numo_cRObject) { \
478
+ robject_store_robject(self, obj); \
479
+ return self; \
480
+ } \
481
+ if (klass == rb_cArray) { \
482
+ robject_store_array(self, obj); \
483
+ return self; \
484
+ } \
485
+ if (IsNArray(obj)) { \
486
+ VALUE r = rb_funcall(obj, rb_intern("coerce_cast"), 1, numo_cRObject); \
487
+ if (rb_obj_class(r) == numo_cRObject) { \
488
+ robject_store(self, r); \
489
+ return self; \
490
+ } \
491
+ } \
492
+ robject_store_numeric(self, obj); \
493
+ return self; \
494
+ }
495
+
496
+ #endif /* NUMO_NARRAY_MH_STORE_H */
@@ -926,13 +926,7 @@ static void iter_bit_store_array(na_loop_t* const lp) {
926
926
  if (idx1) {
927
927
  for (i = i1 = 0; i1 < n1 && i < n; i++, i1++) {
928
928
  x = ptr[i1];
929
- if (rb_obj_is_kind_of(x, rb_cRange)
930
- #ifdef HAVE_RB_ARITHMETIC_SEQUENCE_EXTRACT
931
- || rb_obj_is_kind_of(x, rb_cArithSeq)
932
- #else
933
- || rb_obj_is_kind_of(x, rb_cEnumerator)
934
- #endif
935
- ) {
929
+ if (rb_obj_is_kind_of(x, rb_cRange) || rb_obj_is_kind_of(x, rb_cArithSeq)) {
936
930
  nary_step_sequence(x, &len, &beg, &step);
937
931
  for (c = 0; c < len && i < n; c++, i++) {
938
932
  y = beg + step * c;
@@ -951,13 +945,7 @@ static void iter_bit_store_array(na_loop_t* const lp) {
951
945
  } else {
952
946
  for (i = i1 = 0; i1 < n1 && i < n; i++, i1++) {
953
947
  x = ptr[i1];
954
- if (rb_obj_is_kind_of(x, rb_cRange)
955
- #ifdef HAVE_RB_ARITHMETIC_SEQUENCE_EXTRACT
956
- || rb_obj_is_kind_of(x, rb_cArithSeq)
957
- #else
958
- || rb_obj_is_kind_of(x, rb_cEnumerator)
959
- #endif
960
- ) {
948
+ if (rb_obj_is_kind_of(x, rb_cRange) || rb_obj_is_kind_of(x, rb_cArithSeq)) {
961
949
  nary_step_sequence(x, &len, &beg, &step);
962
950
  for (c = 0; c < len && i < n; c++, i++) {
963
951
  y = beg + step * c;
@@ -2794,12 +2782,7 @@ void Init_numo_bit(void) {
2794
2782
  rb_define_const(cT, "UPCAST", hCast);
2795
2783
  rb_hash_aset(hCast, rb_cArray, cT);
2796
2784
 
2797
- #ifdef RUBY_INTEGER_UNIFICATION
2798
2785
  rb_hash_aset(hCast, rb_cInteger, cT);
2799
- #else
2800
- rb_hash_aset(hCast, rb_cFixnum, cT);
2801
- rb_hash_aset(hCast, rb_cBignum, cT);
2802
- #endif
2803
2786
  rb_hash_aset(hCast, rb_cFloat, numo_cDFloat);
2804
2787
  rb_hash_aset(hCast, rb_cComplex, numo_cDComplex);
2805
2788
  rb_hash_aset(hCast, numo_cRObject, numo_cRObject);