carray 1.2.0 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +0 -1
  3. data/ca_iter_block.c +32 -30
  4. data/ca_iter_dimension.c +24 -22
  5. data/ca_iter_window.c +25 -23
  6. data/ca_obj_array.c +58 -56
  7. data/ca_obj_bitarray.c +27 -27
  8. data/ca_obj_bitfield.c +46 -45
  9. data/ca_obj_block.c +77 -72
  10. data/ca_obj_fake.c +20 -20
  11. data/ca_obj_farray.c +22 -22
  12. data/ca_obj_field.c +31 -30
  13. data/ca_obj_grid.c +63 -62
  14. data/ca_obj_mapping.c +35 -32
  15. data/ca_obj_object.c +54 -54
  16. data/ca_obj_reduce.c +13 -13
  17. data/ca_obj_refer.c +42 -39
  18. data/ca_obj_repeat.c +50 -47
  19. data/ca_obj_select.c +24 -24
  20. data/ca_obj_shift.c +61 -58
  21. data/ca_obj_transpose.c +52 -51
  22. data/ca_obj_unbound_repeat.c +28 -27
  23. data/ca_obj_window.c +77 -72
  24. data/carray.gemspec +0 -2
  25. data/carray.h +190 -163
  26. data/carray_access.c +137 -136
  27. data/carray_attribute.c +24 -13
  28. data/carray_call_cfunc.c +21 -21
  29. data/carray_cast.c +106 -110
  30. data/carray_cast_func.rb +17 -17
  31. data/carray_class.c +3 -3
  32. data/carray_conversion.c +15 -15
  33. data/carray_copy.c +27 -27
  34. data/carray_core.c +22 -21
  35. data/carray_element.c +55 -47
  36. data/carray_generate.c +32 -32
  37. data/carray_iterator.c +36 -35
  38. data/carray_loop.c +37 -37
  39. data/carray_mask.c +21 -21
  40. data/carray_math.rb +18 -18
  41. data/carray_numeric.c +1 -1
  42. data/carray_operator.c +19 -18
  43. data/carray_order.c +30 -30
  44. data/carray_random.c +34 -32
  45. data/carray_sort_addr.c +12 -12
  46. data/carray_stat.c +127 -127
  47. data/carray_stat_proc.rb +152 -141
  48. data/carray_test.c +16 -16
  49. data/carray_utils.c +58 -56
  50. data/ext/calculus/carray_calculus.c +19 -20
  51. data/ext/calculus/carray_interp.c +12 -11
  52. data/ext/fortio/lib/fortio/fortran_sequential.rb +2 -2
  53. data/ext/fortio/ruby_fortio.c +1 -1
  54. data/ext/imagemap/carray_imagemap.c +14 -14
  55. data/ext/narray/ca_wrap_narray.c +30 -21
  56. data/extconf.rb +5 -0
  57. data/lib/carray/base/basic.rb +4 -3
  58. data/lib/carray/base/serialize.rb +3 -3
  59. data/lib/carray/graphics/gnuplot.rb +10 -7
  60. data/lib/carray/io/csv.rb +14 -9
  61. data/lib/carray/io/imagemagick.rb +7 -0
  62. data/lib/carray/io/sqlite3.rb +6 -4
  63. data/mkmath.rb +20 -20
  64. data/ruby_carray.c +2 -0
  65. data/ruby_ccomplex.c +3 -3
  66. data/test/test_130.rb +23 -0
  67. data/test/test_ALL.rb +2 -1
  68. data/test/test_order.rb +3 -3
  69. data/test/test_stat.rb +2 -2
  70. data/version.h +4 -4
  71. metadata +4 -37
  72. data/examples/ex001.rb +0 -10
  73. data/examples/test-int.rb +0 -13
  74. data/lib/carray/autoload/autoload_io_excel.rb +0 -5
  75. data/lib/carray/io/excel.rb +0 -26
data/carray_iterator.c CHANGED
@@ -31,7 +31,7 @@ ca_iter_rank (VALUE self)
31
31
  }
32
32
 
33
33
  void
34
- ca_iter_dim (VALUE self, int32_t *dim)
34
+ ca_iter_dim (VALUE self, ca_size_t *dim)
35
35
  {
36
36
  int i;
37
37
  if ( TYPE(self) == T_DATA ) {
@@ -44,15 +44,15 @@ ca_iter_dim (VALUE self, int32_t *dim)
44
44
  else {
45
45
  VALUE rrank = rb_ivar_get(self, rb_intern("@rank"));
46
46
  VALUE rdim = rb_ivar_get(self, rb_intern("@dim"));
47
- int rank;
48
- rank = NUM2LONG(rrank);
47
+ int8_t rank;
48
+ rank = (int8_t) NUM2INT(rrank);
49
49
  for (i=0; i<rank; i++) {
50
- dim[i] = NUM2LONG(rb_ary_entry(rdim, i));
50
+ dim[i] = NUM2SIZE(rb_ary_entry(rdim, i));
51
51
  }
52
52
  }
53
53
  }
54
54
 
55
- int32_t
55
+ ca_size_t
56
56
  ca_iter_elements (VALUE self)
57
57
  {
58
58
  int i, elements;
@@ -67,10 +67,10 @@ ca_iter_elements (VALUE self)
67
67
  else {
68
68
  VALUE rrank = rb_ivar_get(self, rb_intern("@rank"));
69
69
  VALUE rdim = rb_ivar_get(self, rb_intern("@dim"));
70
- int rank = NUM2LONG(rrank);
70
+ int8_t rank = (int8_t) NUM2INT(rrank);
71
71
  elements = 1;
72
72
  for (i=0; i<rank; i++) {
73
- elements *= NUM2LONG(rb_ary_entry(rdim, i));
73
+ elements *= NUM2SIZE(rb_ary_entry(rdim, i));
74
74
  }
75
75
  }
76
76
  return elements;
@@ -83,7 +83,7 @@ ca_iter_reference (VALUE self)
83
83
  }
84
84
 
85
85
  VALUE
86
- ca_iter_kernel_at_addr (VALUE self, int32_t addr, VALUE rref)
86
+ ca_iter_kernel_at_addr (VALUE self, ca_size_t addr, VALUE rref)
87
87
  {
88
88
  volatile VALUE rker;
89
89
  if ( TYPE(self) == T_DATA ) {
@@ -98,13 +98,13 @@ ca_iter_kernel_at_addr (VALUE self, int32_t addr, VALUE rref)
98
98
  }
99
99
  else {
100
100
  rker = rb_funcall(self, rb_intern("kernel_at_addr"), 2,
101
- INT2NUM(addr), rref);
101
+ SIZE2NUM(addr), rref);
102
102
  }
103
103
  return rker;
104
104
  }
105
105
 
106
106
  VALUE
107
- ca_iter_kernel_at_index (VALUE self, int32_t *idx, VALUE rref)
107
+ ca_iter_kernel_at_index (VALUE self, ca_size_t *idx, VALUE rref)
108
108
  {
109
109
  VALUE rker;
110
110
  if ( TYPE(self) == T_DATA ) {
@@ -123,7 +123,7 @@ ca_iter_kernel_at_index (VALUE self, int32_t *idx, VALUE rref)
123
123
  int i;
124
124
  vidx = rb_ary_new2(rank);
125
125
  for (i=0; i<rank; i++) {
126
- rb_ary_store(vidx, i, INT2NUM(idx[i]));
126
+ rb_ary_store(vidx, i, SIZE2NUM(idx[i]));
127
127
  }
128
128
  rker = rb_funcall(self, rb_intern("kernel_at_index"), 2,
129
129
  vidx, rref);
@@ -132,7 +132,7 @@ ca_iter_kernel_at_index (VALUE self, int32_t *idx, VALUE rref)
132
132
  }
133
133
 
134
134
  VALUE
135
- ca_iter_kernel_move_to_addr (VALUE self, int32_t addr, VALUE rref)
135
+ ca_iter_kernel_move_to_addr (VALUE self, ca_size_t addr, VALUE rref)
136
136
  {
137
137
  if ( TYPE(self) == T_DATA ) {
138
138
  CAIterator *it;
@@ -143,13 +143,13 @@ ca_iter_kernel_move_to_addr (VALUE self, int32_t addr, VALUE rref)
143
143
  }
144
144
  else {
145
145
  rb_funcall(self, rb_intern("kernel_move_to_addr"), 2,
146
- INT2NUM(addr), rref);
146
+ SIZE2NUM(addr), rref);
147
147
  }
148
148
  return rref;
149
149
  }
150
150
 
151
151
  VALUE
152
- ca_iter_kernel_move_to_index (VALUE self, int32_t *idx, VALUE rref)
152
+ ca_iter_kernel_move_to_index (VALUE self, ca_size_t *idx, VALUE rref)
153
153
  {
154
154
  VALUE rker;
155
155
  if ( TYPE(self) == T_DATA ) {
@@ -165,7 +165,7 @@ ca_iter_kernel_move_to_index (VALUE self, int32_t *idx, VALUE rref)
165
165
  int i;
166
166
  vidx = rb_ary_new2(rank);
167
167
  for (i=0; i<rank; i++) {
168
- rb_ary_store(vidx, i, INT2NUM(idx[i]));
168
+ rb_ary_store(vidx, i, SIZE2NUM(idx[i]));
169
169
  }
170
170
  rker = rb_funcall(self, rb_intern("kernel_move_to_index"), 2,
171
171
  vidx, rref);
@@ -180,7 +180,7 @@ ca_iter_prepare_output (VALUE self, VALUE rtype, VALUE rbytes)
180
180
  volatile VALUE obj;
181
181
  CArray *co;
182
182
  int8_t data_type;
183
- int32_t bytes;
183
+ ca_size_t bytes;
184
184
  int i;
185
185
 
186
186
  rb_ca_guess_type_and_bytes(rtype, rbytes, &data_type, &bytes);
@@ -194,9 +194,9 @@ ca_iter_prepare_output (VALUE self, VALUE rtype, VALUE rbytes)
194
194
  VALUE rrank = rb_ivar_get(self, rb_intern("@rank"));
195
195
  VALUE rdim = rb_ivar_get(self, rb_intern("@dim"));
196
196
  int8_t rank = NUM2LONG(rrank);
197
- int32_t dim[CA_RANK_MAX];
197
+ ca_size_t dim[CA_RANK_MAX];
198
198
  for (i=0; i<rank; i++) {
199
- dim[i] = NUM2LONG(rb_ary_entry(rdim, i));
199
+ dim[i] = NUM2SIZE(rb_ary_entry(rdim, i));
200
200
  }
201
201
  co = carray_new_safe(data_type, rank, dim, bytes, NULL);
202
202
  }
@@ -216,6 +216,7 @@ ca_iter_prepare_output (VALUE self, VALUE rtype, VALUE rbytes)
216
216
  end
217
217
  */
218
218
 
219
+
219
220
  VALUE
220
221
  rb_ca_iter_rank (VALUE self)
221
222
  {
@@ -233,13 +234,13 @@ VALUE
233
234
  rb_ca_iter_dim (VALUE self)
234
235
  {
235
236
  VALUE rdim;
236
- int32_t dim[CA_RANK_MAX];
237
+ ca_size_t dim[CA_RANK_MAX];
237
238
  int8_t rank = ca_iter_rank(self);
238
239
  int i;
239
240
  ca_iter_dim(self, dim);
240
241
  rdim = rb_ary_new2(rank);
241
242
  for (i=0; i<rank; i++) {
242
- rb_ary_store(rdim, i, INT2NUM(dim[i]));
243
+ rb_ary_store(rdim, i, SIZE2NUM(dim[i]));
243
244
  }
244
245
  return rdim;
245
246
  }
@@ -254,7 +255,7 @@ rb_ca_iter_dim (VALUE self)
254
255
  VALUE
255
256
  rb_ca_iter_elements (VALUE self)
256
257
  {
257
- return LONG2NUM(ca_iter_elements(self));
258
+ return SIZE2NUM(ca_iter_elements(self));
258
259
  }
259
260
 
260
261
  /* rdoc:
@@ -281,11 +282,11 @@ VALUE
281
282
  rb_ca_iter_kernel_at_addr (int argc, VALUE *argv, VALUE self)
282
283
  {
283
284
  volatile VALUE raddr, rcarray;
284
- rb_scan_args(argc, argv, "11", &raddr, &rcarray);
285
+ rb_scan_args(argc, argv, "11", (VALUE *) &raddr, (VALUE *) &rcarray);
285
286
  if ( NIL_P(rcarray) ) {
286
287
  rcarray = rb_ca_iter_reference(self);
287
288
  }
288
- return ca_iter_kernel_at_addr(self, NUM2LONG(raddr), rcarray);
289
+ return ca_iter_kernel_at_addr(self, NUM2SIZE(raddr), rcarray);
289
290
  }
290
291
 
291
292
  /* rdoc:
@@ -299,18 +300,18 @@ VALUE
299
300
  rb_ca_iter_kernel_at_index (int argc, VALUE *argv, VALUE self)
300
301
  {
301
302
  volatile VALUE rindex, rcarray;
302
- int32_t idx[CA_RANK_MAX];
303
+ ca_size_t idx[CA_RANK_MAX];
303
304
  int8_t rank = ca_iter_rank(self);
304
305
  int i;
305
306
 
306
- rb_scan_args(argc, argv, "11", &rindex, &rcarray);
307
+ rb_scan_args(argc, argv, "11", (VALUE *) &rindex, (VALUE *) &rcarray);
307
308
 
308
309
  if ( NIL_P(rcarray) ) {
309
310
  rcarray = rb_ca_iter_reference(self);
310
311
  }
311
312
 
312
313
  for (i=0; i<rank; i++) {
313
- idx[i] = NUM2LONG(rb_ary_entry(rindex, i));
314
+ idx[i] = NUM2SIZE(rb_ary_entry(rindex, i));
314
315
  }
315
316
 
316
317
  return ca_iter_kernel_at_index(self, idx, rcarray);
@@ -326,7 +327,7 @@ rb_ca_iter_kernel_at_index (int argc, VALUE *argv, VALUE self)
326
327
  VALUE
327
328
  rb_ca_iter_kernel_move_to_addr (VALUE self, VALUE raddr, VALUE rker)
328
329
  {
329
- return ca_iter_kernel_move_to_addr(self, NUM2LONG(raddr), rker);
330
+ return ca_iter_kernel_move_to_addr(self, NUM2SIZE(raddr), rker);
330
331
  }
331
332
 
332
333
  /* rdoc:
@@ -339,12 +340,12 @@ rb_ca_iter_kernel_move_to_addr (VALUE self, VALUE raddr, VALUE rker)
339
340
  VALUE
340
341
  rb_ca_iter_kernel_move_to_index (VALUE self, VALUE rindex, VALUE rker)
341
342
  {
342
- int32_t idx[CA_RANK_MAX];
343
+ ca_size_t idx[CA_RANK_MAX];
343
344
  int8_t rank = ca_iter_rank(self);
344
345
  int i;
345
346
 
346
347
  for (i=0; i<rank; i++) {
347
- idx[i] = NUM2LONG(rb_ary_entry(rindex, i));
348
+ idx[i] = NUM2SIZE(rb_ary_entry(rindex, i));
348
349
  }
349
350
 
350
351
  return ca_iter_kernel_move_to_index(self, idx, rker);
@@ -382,9 +383,9 @@ rb_ca_iter_calculate (int argc, VALUE *argv, VALUE self)
382
383
  {
383
384
  volatile VALUE rtype, rbytes, routput, rref, rker, rout;
384
385
  CArray *co, *cr, *ck;
385
- int32_t elements;
386
+ ca_size_t elements;
386
387
  int8_t data_type;
387
- int32_t bytes;
388
+ ca_size_t bytes;
388
389
  int i;
389
390
 
390
391
  if ( argc < 1 ) {
@@ -398,12 +399,12 @@ rb_ca_iter_calculate (int argc, VALUE *argv, VALUE self)
398
399
 
399
400
  if ( NIL_P(argv[0]) ) {
400
401
  rtype = INT2NUM(cr->data_type);
401
- rbytes = INT2NUM(cr->bytes);
402
+ rbytes = SIZE2NUM(cr->bytes);
402
403
  }
403
404
  else {
404
405
  rb_ca_guess_type_and_bytes(argv[0], Qnil, &data_type, &bytes);
405
406
  rtype = INT2NUM(data_type);
406
- rbytes = INT2NUM(bytes);
407
+ rbytes = SIZE2NUM(bytes);
407
408
  }
408
409
  argc--;
409
410
  argv++;
@@ -481,7 +482,7 @@ rb_ca_iter_filter (int argc, VALUE *argv, VALUE self)
481
482
  {
482
483
  volatile VALUE routput, rref, rker, rout;
483
484
  CArray *co, *cr, *ck, *cq;
484
- int32_t elements;
485
+ ca_size_t elements;
485
486
  int8_t data_type;
486
487
  int i;
487
488
 
@@ -558,7 +559,7 @@ rb_ca_iter_evaluate (int argc, VALUE *argv, VALUE self)
558
559
  {
559
560
  volatile VALUE rref, rker;
560
561
  CArray *cr, *ck;
561
- int32_t elements;
562
+ ca_size_t elements;
562
563
  int i;
563
564
 
564
565
  elements = ca_iter_elements(self);
data/carray_loop.c CHANGED
@@ -17,7 +17,7 @@ rb_ca_s_each_index_internal (int rank, VALUE *dim, uint8_t irank, VALUE ridx)
17
17
  {
18
18
  volatile VALUE ret = Qnil;
19
19
  int32_t is_leaf = (irank == rank - 1);
20
- int32_t i;
20
+ ca_size_t i;
21
21
 
22
22
  if ( NIL_P(dim[irank]) ) {
23
23
  rb_ary_store(ridx, irank, Qnil);
@@ -29,8 +29,8 @@ rb_ca_s_each_index_internal (int rank, VALUE *dim, uint8_t irank, VALUE ridx)
29
29
  }
30
30
  }
31
31
  else {
32
- for (i=0; i<NUM2LONG(dim[irank]); i++) {
33
- rb_ary_store(ridx, irank, INT2NUM(i));
32
+ for (i=0; i<NUM2SIZE(dim[irank]); i++) {
33
+ rb_ary_store(ridx, irank, SIZE2NUM(i));
34
34
  if ( is_leaf ) {
35
35
  ret = rb_yield_splat(rb_obj_clone(ridx));
36
36
  }
@@ -81,8 +81,8 @@ static VALUE
81
81
  rb_ca_each (VALUE self)
82
82
  {
83
83
  volatile VALUE ret = Qnil;
84
- int32_t elements = NUM2LONG(rb_ca_elements(self));
85
- int32_t i;
84
+ ca_size_t elements = NUM2SIZE(rb_ca_elements(self));
85
+ ca_size_t i;
86
86
  #if RUBY_VERSION_CODE >= 190
87
87
  RETURN_ENUMERATOR(self, 0, 0);
88
88
  #endif
@@ -104,13 +104,13 @@ static VALUE
104
104
  rb_ca_each_with_addr (VALUE self)
105
105
  {
106
106
  volatile VALUE ret = Qnil;
107
- int32_t elements = NUM2LONG(rb_ca_elements(self));
108
- int32_t i;
107
+ ca_size_t elements = NUM2SIZE(rb_ca_elements(self));
108
+ ca_size_t i;
109
109
  #if RUBY_VERSION_CODE >= 190
110
110
  RETURN_ENUMERATOR(self, 0, 0);
111
111
  #endif
112
112
  for (i=0; i<elements; i++) {
113
- ret = rb_yield_values(2, rb_ca_fetch_addr(self, i), INT2NUM(i));
113
+ ret = rb_yield_values(2, rb_ca_fetch_addr(self, i), SIZE2NUM(i));
114
114
  }
115
115
  return ret;
116
116
  }
@@ -127,13 +127,13 @@ static VALUE
127
127
  rb_ca_each_addr (VALUE self)
128
128
  {
129
129
  volatile VALUE ret = Qnil;
130
- int32_t elements = NUM2LONG(rb_ca_elements(self));
131
- int32_t i;
130
+ ca_size_t elements = NUM2SIZE(rb_ca_elements(self));
131
+ ca_size_t i;
132
132
  #if RUBY_VERSION_CODE >= 190
133
133
  RETURN_ENUMERATOR(self, 0, 0);
134
134
  #endif
135
135
  for (i=0; i<elements; i++) {
136
- ret = rb_yield(LONG2NUM(i));
136
+ ret = rb_yield(SIZE2NUM(i));
137
137
  }
138
138
  return ret;
139
139
  }
@@ -143,17 +143,17 @@ rb_ca_each_index_internal (VALUE self, int8_t level, VALUE ridx)
143
143
  {
144
144
  volatile VALUE ret = Qnil;
145
145
  CArray *ca;
146
- int32_t i;
146
+ ca_size_t i;
147
147
  Data_Get_Struct(self, CArray, ca);
148
148
  if ( level == ca->rank - 1 ) {
149
149
  for (i=0; i<ca->dim[level]; i++) {
150
- rb_ary_store(ridx, level, INT2NUM(i));
150
+ rb_ary_store(ridx, level, SIZE2NUM(i));
151
151
  ret = rb_yield_splat(rb_obj_clone(ridx));
152
152
  }
153
153
  }
154
154
  else {
155
155
  for (i=0; i<ca->dim[level]; i++) {
156
- rb_ary_store(ridx, level, INT2NUM(i));
156
+ rb_ary_store(ridx, level, SIZE2NUM(i));
157
157
  ret = rb_ca_each_index_internal(self, level+1, ridx);
158
158
  }
159
159
  }
@@ -200,8 +200,8 @@ rb_ca_map_bang (VALUE self)
200
200
  {
201
201
  volatile VALUE obj;
202
202
  CArray *ca;
203
- int32_t elements = NUM2LONG(rb_ca_elements(self));
204
- int32_t i;
203
+ ca_size_t elements = NUM2SIZE(rb_ca_elements(self));
204
+ ca_size_t i;
205
205
  #if RUBY_VERSION_CODE >= 190
206
206
  RETURN_ENUMERATOR(self, 0, 0);
207
207
  #endif
@@ -219,16 +219,16 @@ rb_ca_map_bang (VALUE self)
219
219
 
220
220
  static VALUE
221
221
  rb_ca_each_with_index_internal (VALUE self,
222
- int8_t level, int32_t *idx, VALUE ridx)
222
+ int8_t level, ca_size_t *idx, VALUE ridx)
223
223
  {
224
224
  volatile VALUE ret = Qnil;
225
225
  CArray *ca;
226
- int32_t i;
226
+ ca_size_t i;
227
227
  Data_Get_Struct(self, CArray, ca);
228
228
  if ( level == ca->rank - 1 ) {
229
229
  for (i=0; i<ca->dim[level]; i++) {
230
230
  idx[level] = i;
231
- rb_ary_store(ridx, level, INT2NUM(i));
231
+ rb_ary_store(ridx, level, SIZE2NUM(i));
232
232
  ret = rb_yield_values(2, rb_ca_fetch_index(self, idx),
233
233
  rb_obj_clone(ridx));
234
234
  }
@@ -236,7 +236,7 @@ rb_ca_each_with_index_internal (VALUE self,
236
236
  else {
237
237
  for (i=0; i<ca->dim[level]; i++) {
238
238
  idx[level] = i;
239
- rb_ary_store(ridx, level, INT2NUM(i));
239
+ rb_ary_store(ridx, level, SIZE2NUM(i));
240
240
  ret = rb_ca_each_with_index_internal(self, level+1, idx, ridx);
241
241
  }
242
242
  }
@@ -255,7 +255,7 @@ static VALUE
255
255
  rb_ca_each_with_index (VALUE self)
256
256
  {
257
257
  volatile VALUE ridx, ret;
258
- int32_t idx[CA_RANK_MAX];
258
+ ca_size_t idx[CA_RANK_MAX];
259
259
  int8_t rank = NUM2INT(rb_ca_rank(self));
260
260
  #if RUBY_VERSION_CODE >= 190
261
261
  RETURN_ENUMERATOR(self, 0, 0);
@@ -269,16 +269,16 @@ rb_ca_each_with_index (VALUE self)
269
269
 
270
270
  static void
271
271
  rb_ca_map_with_index_bang_internal (VALUE self,
272
- int8_t level, int32_t *idx, VALUE ridx)
272
+ int8_t level, ca_size_t *idx, VALUE ridx)
273
273
  {
274
274
  CArray *ca;
275
- int32_t i;
275
+ ca_size_t i;
276
276
  Data_Get_Struct(self, CArray, ca);
277
277
  if ( level == ca->rank - 1 ) {
278
278
  volatile VALUE obj;
279
279
  for (i=0; i<ca->dim[level]; i++) {
280
280
  idx[level] = i;
281
- rb_ary_store(ridx, level, INT2NUM(i));
281
+ rb_ary_store(ridx, level, SIZE2NUM(i));
282
282
  obj = rb_yield_values(2, rb_ca_fetch_index(self, idx),
283
283
  rb_obj_clone(ridx));
284
284
  rb_ca_store_index(self, idx, obj);
@@ -287,7 +287,7 @@ rb_ca_map_with_index_bang_internal (VALUE self,
287
287
  else {
288
288
  for (i=0; i<ca->dim[level]; i++) {
289
289
  idx[level] = i;
290
- rb_ary_store(ridx, level, INT2NUM(i));
290
+ rb_ary_store(ridx, level, SIZE2NUM(i));
291
291
  rb_ca_map_with_index_bang_internal(self, level+1, idx, ridx);
292
292
  }
293
293
  }
@@ -306,7 +306,7 @@ rb_ca_map_with_index_bang (VALUE self)
306
306
  {
307
307
  volatile VALUE ridx;
308
308
  CArray *ca;
309
- int32_t idx[CA_RANK_MAX];
309
+ ca_size_t idx[CA_RANK_MAX];
310
310
  int8_t rank = NUM2INT(rb_ca_rank(self));
311
311
  #if RUBY_VERSION_CODE >= 190
312
312
  RETURN_ENUMERATOR(self, 0, 0);
@@ -324,16 +324,16 @@ rb_ca_map_with_index_bang (VALUE self)
324
324
 
325
325
  static void
326
326
  rb_ca_map_index_bang_internal (VALUE self,
327
- int8_t level, int32_t *idx, VALUE ridx)
327
+ int8_t level, ca_size_t *idx, VALUE ridx)
328
328
  {
329
329
  CArray *ca;
330
- int32_t i;
330
+ ca_size_t i;
331
331
  Data_Get_Struct(self, CArray, ca);
332
332
  if ( level == ca->rank - 1 ) {
333
333
  volatile VALUE obj;
334
334
  for (i=0; i<ca->dim[level]; i++) {
335
335
  idx[level] = i;
336
- rb_ary_store(ridx, level, INT2NUM(i));
336
+ rb_ary_store(ridx, level, SIZE2NUM(i));
337
337
  obj = rb_yield_splat(rb_obj_clone(ridx));
338
338
  rb_ca_store_index(self, idx, obj);
339
339
  }
@@ -341,7 +341,7 @@ rb_ca_map_index_bang_internal (VALUE self,
341
341
  else {
342
342
  for (i=0; i<ca->dim[level]; i++) {
343
343
  idx[level] = i;
344
- rb_ary_store(ridx, level, INT2NUM(i));
344
+ rb_ary_store(ridx, level, SIZE2NUM(i));
345
345
  rb_ca_map_index_bang_internal(self, level+1, idx, ridx);
346
346
  }
347
347
  }
@@ -360,7 +360,7 @@ rb_ca_map_index_bang (VALUE self)
360
360
  {
361
361
  volatile VALUE ridx;
362
362
  CArray *ca;
363
- int32_t idx[CA_RANK_MAX];
363
+ ca_size_t idx[CA_RANK_MAX];
364
364
  int8_t rank = NUM2INT(rb_ca_rank(self));
365
365
  #if RUBY_VERSION_CODE >= 190
366
366
  RETURN_ENUMERATOR(self, 0, 0);
@@ -388,8 +388,8 @@ rb_ca_map_with_addr_bang (VALUE self)
388
388
  {
389
389
  volatile VALUE obj;
390
390
  CArray *ca;
391
- int32_t elements = NUM2LONG(rb_ca_elements(self));
392
- int32_t i;
391
+ ca_size_t elements = NUM2SIZE(rb_ca_elements(self));
392
+ ca_size_t i;
393
393
  #if RUBY_VERSION_CODE >= 190
394
394
  RETURN_ENUMERATOR(self, 0, 0);
395
395
  #endif
@@ -397,7 +397,7 @@ rb_ca_map_with_addr_bang (VALUE self)
397
397
  Data_Get_Struct(self, CArray, ca);
398
398
  ca_attach(ca);
399
399
  for (i=0; i<elements; i++) {
400
- obj = rb_yield_values(2, rb_ca_fetch_addr(self, i), LONG2NUM(i));
400
+ obj = rb_yield_values(2, rb_ca_fetch_addr(self, i), SIZE2NUM(i));
401
401
  rb_ca_store_addr(self, i, obj);
402
402
  }
403
403
  ca_sync(ca);
@@ -419,8 +419,8 @@ rb_ca_map_addr_bang (VALUE self)
419
419
  {
420
420
  volatile VALUE obj;
421
421
  CArray *ca;
422
- int32_t elements = NUM2LONG(rb_ca_elements(self));
423
- int32_t i;
422
+ ca_size_t elements = NUM2SIZE(rb_ca_elements(self));
423
+ ca_size_t i;
424
424
  #if RUBY_VERSION_CODE >= 190
425
425
  RETURN_ENUMERATOR(self, 0, 0);
426
426
  #endif
@@ -428,7 +428,7 @@ rb_ca_map_addr_bang (VALUE self)
428
428
  Data_Get_Struct(self, CArray, ca);
429
429
  ca_attach(ca);
430
430
  for (i=0; i<elements; i++) {
431
- obj = rb_yield(LONG2NUM(i));
431
+ obj = rb_yield(SIZE2NUM(i));
432
432
  rb_ca_store_addr(self, i, obj);
433
433
  }
434
434
  ca_sync(ca);