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_element.c CHANGED
@@ -26,9 +26,10 @@ VALUE
26
26
  rb_ca_elem_swap (VALUE self, VALUE ridx1, VALUE ridx2)
27
27
  {
28
28
  CArray *ca;
29
- int32_t idx1[CA_RANK_MAX], idx2[CA_RANK_MAX];
30
- int32_t addr1 = 0, addr2 = 0;
31
- int32_t i,k;
29
+ ca_size_t idx1[CA_RANK_MAX], idx2[CA_RANK_MAX];
30
+ ca_size_t addr1 = 0, addr2 = 0;
31
+ int8_t i;
32
+ ca_size_t k;
32
33
  int has_mask, has_index1, has_index2;
33
34
  char _val1[32], _val2[32];
34
35
  char *val1 = _val1, *val2 = _val2;
@@ -48,7 +49,7 @@ rb_ca_elem_swap (VALUE self, VALUE ridx1, VALUE ridx2)
48
49
 
49
50
  if ( TYPE(ridx1) == T_ARRAY ) {
50
51
  for (i=0; i<ca->rank; i++) {
51
- k = NUM2INT(rb_ary_entry(ridx1, i));
52
+ k = NUM2SIZE(rb_ary_entry(ridx1, i));
52
53
  CA_CHECK_INDEX(k, ca->dim[i]);
53
54
  idx1[i] = k;
54
55
  }
@@ -59,7 +60,7 @@ rb_ca_elem_swap (VALUE self, VALUE ridx1, VALUE ridx2)
59
60
  }
60
61
  }
61
62
  else {
62
- k = NUM2INT(ridx1);
63
+ k = NUM2SIZE(ridx1);
63
64
  CA_CHECK_INDEX(k, ca->elements);
64
65
  addr1 = k;
65
66
  has_index1 = 0;
@@ -71,7 +72,7 @@ rb_ca_elem_swap (VALUE self, VALUE ridx1, VALUE ridx2)
71
72
 
72
73
  if ( TYPE(ridx2) == T_ARRAY ) {
73
74
  for (i=0; i<ca->rank; i++) {
74
- k = NUM2INT(rb_ary_entry(ridx2, i));
75
+ k = NUM2SIZE(rb_ary_entry(ridx2, i));
75
76
  CA_CHECK_INDEX(k, ca->dim[i]);
76
77
  idx2[i] = k;
77
78
  }
@@ -82,7 +83,7 @@ rb_ca_elem_swap (VALUE self, VALUE ridx1, VALUE ridx2)
82
83
  }
83
84
  }
84
85
  else {
85
- k = NUM2INT(ridx2);
86
+ k = NUM2SIZE(ridx2);
86
87
  CA_CHECK_INDEX(k, ca->elements);
87
88
  addr2 = k;
88
89
  has_index2 = 0;
@@ -137,9 +138,10 @@ VALUE
137
138
  rb_ca_elem_copy (VALUE self, VALUE ridx1, VALUE ridx2)
138
139
  {
139
140
  CArray *ca;
140
- int32_t idx1[CA_RANK_MAX], idx2[CA_RANK_MAX];
141
- int32_t addr1 = 0, addr2 = 0;
142
- int32_t i,k;
141
+ ca_size_t idx1[CA_RANK_MAX], idx2[CA_RANK_MAX];
142
+ ca_size_t addr1 = 0, addr2 = 0;
143
+ int8_t i;
144
+ ca_size_t k;
143
145
  int has_mask;
144
146
  char _val[32];
145
147
  char *val = _val;
@@ -158,7 +160,7 @@ rb_ca_elem_copy (VALUE self, VALUE ridx1, VALUE ridx2)
158
160
 
159
161
  if ( TYPE(ridx1) == T_ARRAY ) {
160
162
  for (i=0; i<ca->rank; i++) {
161
- k = NUM2INT(rb_ary_entry(ridx1, i));
163
+ k = NUM2SIZE(rb_ary_entry(ridx1, i));
162
164
  CA_CHECK_INDEX(k, ca->dim[i]);
163
165
  idx1[i] = k;
164
166
  }
@@ -168,7 +170,7 @@ rb_ca_elem_copy (VALUE self, VALUE ridx1, VALUE ridx2)
168
170
  }
169
171
  }
170
172
  else {
171
- k = NUM2INT(ridx1);
173
+ k = NUM2SIZE(ridx1);
172
174
  CA_CHECK_INDEX(k, ca->elements);
173
175
  addr1 = k;
174
176
  ca_fetch_addr(ca, addr1, val);
@@ -179,7 +181,7 @@ rb_ca_elem_copy (VALUE self, VALUE ridx1, VALUE ridx2)
179
181
 
180
182
  if ( TYPE(ridx2) == T_ARRAY ) {
181
183
  for (i=0; i<ca->rank; i++) {
182
- k = NUM2INT(rb_ary_entry(ridx2, i));
184
+ k = NUM2SIZE(rb_ary_entry(ridx2, i));
183
185
  CA_CHECK_INDEX(k, ca->dim[i]);
184
186
  idx2[i] = k;
185
187
  }
@@ -189,7 +191,7 @@ rb_ca_elem_copy (VALUE self, VALUE ridx1, VALUE ridx2)
189
191
  }
190
192
  }
191
193
  else {
192
- k = NUM2INT(ridx2);
194
+ k = NUM2SIZE(ridx2);
193
195
  CA_CHECK_INDEX(k, ca->elements);
194
196
  addr2 = k;
195
197
  ca_store_addr(ca, addr2, val);
@@ -216,9 +218,10 @@ VALUE
216
218
  rb_ca_elem_store (VALUE self, VALUE ridx, VALUE obj)
217
219
  {
218
220
  CArray *ca;
219
- int32_t idx[CA_RANK_MAX];
220
- int32_t addr = 0;
221
- int32_t i,k;
221
+ ca_size_t idx[CA_RANK_MAX];
222
+ ca_size_t addr = 0;
223
+ int8_t i;
224
+ ca_size_t k;
222
225
 
223
226
  rb_ca_modify(self);
224
227
 
@@ -226,14 +229,14 @@ rb_ca_elem_store (VALUE self, VALUE ridx, VALUE obj)
226
229
 
227
230
  if ( TYPE(ridx) == T_ARRAY ) {
228
231
  for (i=0; i<ca->rank; i++) {
229
- k = NUM2INT(rb_ary_entry(ridx, i));
232
+ k = NUM2SIZE(rb_ary_entry(ridx, i));
230
233
  CA_CHECK_INDEX(k, ca->dim[i]);
231
234
  idx[i] = k;
232
235
  }
233
236
  rb_ca_store_index(self, idx, obj);
234
237
  }
235
238
  else {
236
- k = NUM2INT(ridx);
239
+ k = NUM2SIZE(ridx);
237
240
  CA_CHECK_INDEX(k, ca->elements);
238
241
  addr = k;
239
242
  rb_ca_store_addr(self, addr, obj);
@@ -253,22 +256,23 @@ VALUE
253
256
  rb_ca_elem_fetch (VALUE self, VALUE ridx)
254
257
  {
255
258
  CArray *ca;
256
- int32_t idx[CA_RANK_MAX];
257
- int32_t addr = 0;
258
- int32_t i,k;
259
+ ca_size_t idx[CA_RANK_MAX];
260
+ ca_size_t addr = 0;
261
+ int8_t i;
262
+ ca_size_t k;
259
263
 
260
264
  Data_Get_Struct(self, CArray, ca);
261
265
 
262
266
  if ( TYPE(ridx) == T_ARRAY ) {
263
267
  for (i=0; i<ca->rank; i++) {
264
- k = NUM2INT(rb_ary_entry(ridx, i));
268
+ k = NUM2SIZE(rb_ary_entry(ridx, i));
265
269
  CA_CHECK_INDEX(k, ca->dim[i]);
266
270
  idx[i] = k;
267
271
  }
268
272
  return rb_ca_fetch_index(self, idx);
269
273
  }
270
274
  else {
271
- k = NUM2INT(ridx);
275
+ k = NUM2SIZE(ridx);
272
276
  CA_CHECK_INDEX(k, ca->elements);
273
277
  addr = k;
274
278
  return rb_ca_fetch_addr(self, addr);
@@ -287,9 +291,10 @@ rb_ca_elem_incr (VALUE self, VALUE ridx1)
287
291
  {
288
292
  volatile VALUE out;
289
293
  CArray *ca;
290
- int32_t idx1[CA_RANK_MAX];
291
- int32_t addr1 = 0;
292
- int32_t i,k;
294
+ ca_size_t idx1[CA_RANK_MAX];
295
+ ca_size_t addr1 = 0;
296
+ int8_t i;
297
+ ca_size_t k;
293
298
  int has_index1 = 0;
294
299
  int has_mask;
295
300
  char _val[8];
@@ -310,7 +315,7 @@ rb_ca_elem_incr (VALUE self, VALUE ridx1)
310
315
 
311
316
  if ( TYPE(ridx1) == T_ARRAY ) {
312
317
  for (i=0; i<ca->rank; i++) {
313
- k = NUM2INT(rb_ary_entry(ridx1, i));
318
+ k = NUM2SIZE(rb_ary_entry(ridx1, i));
314
319
  CA_CHECK_INDEX(k, ca->dim[i]);
315
320
  idx1[i] = k;
316
321
  }
@@ -326,7 +331,7 @@ rb_ca_elem_incr (VALUE self, VALUE ridx1)
326
331
  has_index1 = 1;
327
332
  }
328
333
  else {
329
- k = NUM2INT(ridx1);
334
+ k = NUM2SIZE(ridx1);
330
335
  CA_CHECK_INDEX(k, ca->elements);
331
336
  addr1 = k;
332
337
  if ( has_mask ) {
@@ -347,8 +352,8 @@ rb_ca_elem_incr (VALUE self, VALUE ridx1)
347
352
  case CA_UINT16: out = UINT2NUM(++*((uint16_t*) val)); break;
348
353
  case CA_INT32: out = INT2NUM(++*((int32_t*) val)); break;
349
354
  case CA_UINT32: out = UINT2NUM(++*((uint32_t*) val)); break;
350
- case CA_INT64: out = INT2NUM(++*((int64_t*) val)); break;
351
- case CA_UINT64: out = UINT2NUM(++*((uint64_t*) val)); break;
355
+ case CA_INT64: out = LL2NUM(++*((int64_t*) val)); break;
356
+ case CA_UINT64: out = ULL2NUM(++*((uint64_t*) val)); break;
352
357
  }
353
358
 
354
359
  if ( has_index1 ) {
@@ -373,9 +378,10 @@ rb_ca_elem_decr (VALUE self, VALUE ridx1)
373
378
  {
374
379
  volatile VALUE out;
375
380
  CArray *ca;
376
- int32_t idx1[CA_RANK_MAX];
377
- int32_t addr1 = 0;
378
- int32_t i,k;
381
+ ca_size_t idx1[CA_RANK_MAX];
382
+ ca_size_t addr1 = 0;
383
+ int8_t i;
384
+ ca_size_t k;
379
385
  int has_index1 = 0;
380
386
  int has_mask;
381
387
  char _val[8];
@@ -396,7 +402,7 @@ rb_ca_elem_decr (VALUE self, VALUE ridx1)
396
402
 
397
403
  if ( TYPE(ridx1) == T_ARRAY ) {
398
404
  for (i=0; i<ca->rank; i++) {
399
- k = NUM2INT(rb_ary_entry(ridx1, i));
405
+ k = NUM2SIZE(rb_ary_entry(ridx1, i));
400
406
  CA_CHECK_INDEX(k, ca->dim[i]);
401
407
  idx1[i] = k;
402
408
  }
@@ -412,7 +418,7 @@ rb_ca_elem_decr (VALUE self, VALUE ridx1)
412
418
  has_index1 = 1;
413
419
  }
414
420
  else {
415
- k = NUM2INT(ridx1);
421
+ k = NUM2SIZE(ridx1);
416
422
  CA_CHECK_INDEX(k, ca->elements);
417
423
  addr1 = k;
418
424
  if ( has_mask ) {
@@ -458,9 +464,10 @@ VALUE
458
464
  rb_ca_elem_test_masked (VALUE self, VALUE ridx1)
459
465
  {
460
466
  CArray *ca;
461
- int32_t idx1[CA_RANK_MAX];
462
- int32_t addr1 = 0;
463
- int32_t i, k;
467
+ ca_size_t idx1[CA_RANK_MAX];
468
+ ca_size_t addr1 = 0;
469
+ int8_t i;
470
+ ca_size_t k;
464
471
  boolean8_t m = 0;
465
472
 
466
473
  Data_Get_Struct(self, CArray, ca);
@@ -469,7 +476,7 @@ rb_ca_elem_test_masked (VALUE self, VALUE ridx1)
469
476
 
470
477
  if ( TYPE(ridx1) == T_ARRAY ) {
471
478
  for (i=0; i<ca->rank; i++) {
472
- k = NUM2INT(rb_ary_entry(ridx1, i));
479
+ k = NUM2SIZE(rb_ary_entry(ridx1, i));
473
480
  CA_CHECK_INDEX(k, ca->dim[i]);
474
481
  idx1[i] = k;
475
482
  }
@@ -478,7 +485,7 @@ rb_ca_elem_test_masked (VALUE self, VALUE ridx1)
478
485
  }
479
486
  }
480
487
  else {
481
- k = NUM2INT(ridx1);
488
+ k = NUM2SIZE(ridx1);
482
489
  CA_CHECK_INDEX(k, ca->elements);
483
490
  addr1 = k;
484
491
  if ( ca->mask ) {
@@ -503,22 +510,23 @@ static VALUE
503
510
  rb_ca_incr_addr (volatile VALUE self, volatile VALUE raddr)
504
511
  {
505
512
  CArray *ca, *ci;
506
- int32_t *q, *p, k, elements;
507
- int32_t i;
513
+ int64_t *q, *p;
514
+ ca_size_t k, elements;
515
+ ca_size_t i;
508
516
  boolean8_t *m;
509
517
 
510
518
  rb_ca_modify(self);
511
519
 
512
- self = rb_ca_wrap_writable(self, INT2FIX(CA_INT32));
513
- raddr = rb_ca_wrap_readonly(raddr, INT2FIX(CA_INT32));
520
+ self = rb_ca_wrap_writable(self, INT2NUM(CA_INT64));
521
+ raddr = rb_ca_wrap_readonly(raddr, INT2NUM(CA_INT64));
514
522
 
515
523
  Data_Get_Struct(self, CArray, ca);
516
524
  Data_Get_Struct(raddr, CArray, ci);
517
525
 
518
526
  ca_attach_n(2, ca, ci);
519
527
 
520
- q = (int32_t *) ca->ptr;
521
- p = (int32_t *) ci->ptr;
528
+ q = (int64_t *) ca->ptr;
529
+ p = (int64_t *) ci->ptr;
522
530
  m = ( ci->mask ) ? (boolean8_t *) ci->mask->ptr : NULL;
523
531
 
524
532
  elements = ca->elements;
data/carray_generate.c CHANGED
@@ -31,7 +31,7 @@
31
31
  static VALUE
32
32
  rb_ca_boolean_set (int argc, VALUE *argv, VALUE self)
33
33
  {
34
- VALUE one = INT2FIX(1);
34
+ VALUE one = INT2NUM(1);
35
35
  rb_ca_modify(self);
36
36
  if ( ! rb_ca_is_boolean_type(self) ) {
37
37
  rb_raise(rb_eCADataTypeError, "reciever should be a boolean array");
@@ -43,7 +43,7 @@ rb_ca_boolean_set (int argc, VALUE *argv, VALUE self)
43
43
  static VALUE
44
44
  rb_ca_boolean_unset (int argc, VALUE *argv, VALUE self)
45
45
  {
46
- VALUE zero = INT2FIX(0);
46
+ VALUE zero = INT2NUM(0);
47
47
  rb_ca_modify(self);
48
48
  if ( ! rb_ca_is_boolean_type(self) ) {
49
49
  rb_raise(rb_eCADataTypeError, "reciever should be a boolean array");
@@ -68,8 +68,8 @@ rb_ca_where (VALUE self)
68
68
  volatile VALUE bool, obj;
69
69
  CArray *ca, *co;
70
70
  boolean8_t *p, *m;
71
- int32_t *q;
72
- int32_t i, count;
71
+ ca_size_t *q;
72
+ ca_size_t i, count;
73
73
 
74
74
  bool = ( ! rb_ca_is_boolean_type(self) ) ? rb_ca_to_boolean(self) : self;
75
75
 
@@ -95,12 +95,12 @@ rb_ca_where (VALUE self)
95
95
  }
96
96
 
97
97
  /* create output array */
98
- obj = rb_carray_new(CA_INT32, 1, &count, 0, NULL);
98
+ obj = rb_carray_new(CA_SIZE, 1, &count, 0, NULL);
99
99
  Data_Get_Struct(obj, CArray, co);
100
100
 
101
101
  /* store address which elements is true to output array */
102
102
  p = (boolean8_t *) ca->ptr;
103
- q = (int32_t *) co->ptr;
103
+ q = (ca_size_t *) co->ptr;
104
104
  m = ca_mask_ptr(ca);
105
105
  if ( m ) {
106
106
  for (i=0; i<ca->elements; i++) { /* not-masked && true */
@@ -125,25 +125,25 @@ rb_ca_where (VALUE self)
125
125
  #define proc_seq_bang(type, from, to) \
126
126
  { \
127
127
  type *p = (type *)ca->ptr; \
128
- int32_t i; \
128
+ ca_size_t i; \
129
129
  if ( NIL_P(roffset) && NIL_P(rstep) ) { \
130
130
  for (i=0; i<ca->elements; i++) { \
131
- *p++ = to(i); \
131
+ *p++ = (type) to(i); \
132
132
  } \
133
133
  } \
134
134
  else if ( rb_obj_is_kind_of(rstep, rb_cFloat) || \
135
135
  rb_obj_is_kind_of(roffset, rb_cFloat) ) { \
136
- type offset = (NIL_P(roffset)) ? (type) 0 : from(roffset); \
136
+ type offset = (NIL_P(roffset)) ? (type) 0 : (type) from(roffset); \
137
137
  double step = (NIL_P(rstep)) ? 1 : NUM2DBL(rstep); \
138
138
  for (i=0; i<ca->elements; i++) { \
139
- *p++ = to(step*i+offset); \
139
+ *p++ = (type) to(step*i+offset); \
140
140
  } \
141
141
  } \
142
142
  else { \
143
- type offset = (NIL_P(roffset)) ? (type) 0 : from(roffset); \
144
- type step = (NIL_P(rstep)) ? (type) 1 : from(rstep); \
143
+ type offset = (NIL_P(roffset)) ? (type) 0 : (type) from(roffset); \
144
+ type step = (NIL_P(rstep)) ? (type) 1 : (type) from(rstep); \
145
145
  for (i=0; i<ca->elements; i++) { \
146
- *p++ = to(step*i+offset); \
146
+ *p++ = (type) to(step*i+offset); \
147
147
  } \
148
148
  } \
149
149
  }
@@ -151,25 +151,25 @@ rb_ca_where (VALUE self)
151
151
  #define proc_seq_bang_with_block(type, from, to) \
152
152
  { \
153
153
  type *p = (type *)ca->ptr; \
154
- int32_t i; \
154
+ ca_size_t i; \
155
155
  if ( NIL_P(roffset) && NIL_P(rstep) ) { \
156
156
  for (i=0; i<ca->elements; i++) { \
157
- *p++ = from(rb_yield(INT2NUM(i))); \
157
+ *p++ = (type) from(rb_yield(SIZE2NUM(i))); \
158
158
  } \
159
159
  } \
160
160
  else if ( rb_obj_is_kind_of(rstep, rb_cFloat) || \
161
161
  rb_obj_is_kind_of(roffset, rb_cFloat)) { \
162
- type offset = (NIL_P(roffset)) ? (type) 0 : from(roffset); \
162
+ type offset = (NIL_P(roffset)) ? (type) 0 : (type) from(roffset); \
163
163
  double step = (NIL_P(rstep)) ? 1 : NUM2DBL(rstep); \
164
164
  for (i=0; i<ca->elements; i++) { \
165
- *p++ = from(rb_yield(rb_float_new(step*i+offset))); \
165
+ *p++ = (type) from(rb_yield(rb_float_new(step*i+offset))); \
166
166
  } \
167
167
  } \
168
168
  else { \
169
- type offset = (NIL_P(roffset)) ? (type) 0 : from(roffset); \
170
- type step = (NIL_P(rstep)) ? (type) 1 : from(rstep); \
169
+ type offset = (NIL_P(roffset)) ? (type) 0 : (type) from(roffset); \
170
+ type step = (NIL_P(rstep)) ? (type) 1 : (type) from(rstep); \
171
171
  for (i=0; i<ca->elements; i++) { \
172
- *p++ = from(rb_yield(INT2NUM(step*i+offset))); \
172
+ *p++ = (type) from(rb_yield(SIZE2NUM(step*i+offset))); \
173
173
  } \
174
174
  } \
175
175
  }
@@ -180,11 +180,11 @@ rb_ca_seq_bang_object (int argc, VALUE *argv, VALUE self)
180
180
  volatile VALUE roffset, rstep, rval, rmethod = Qnil;
181
181
  CArray *ca;
182
182
  VALUE *p;
183
- int32_t i;
183
+ ca_size_t i;
184
184
 
185
185
  Data_Get_Struct(self, CArray, ca);
186
186
 
187
- rb_scan_args((argc>2) ? 2 : argc, argv, "02", &roffset, &rstep);
187
+ rb_scan_args((argc>2) ? 2 : argc, argv, "02", (VALUE *) &roffset, (VALUE *) &rstep);
188
188
 
189
189
  if ( TYPE(rstep) == T_SYMBOL ) { /* e.g. a.seq("a", :succ) */
190
190
  rmethod = rstep;
@@ -280,7 +280,7 @@ rb_ca_seq_bang_method (int argc, VALUE *argv, VALUE self)
280
280
  return rb_ca_seq_bang_object(argc, argv, self);
281
281
  }
282
282
 
283
- rb_scan_args(argc, argv, "02", &roffset, &rstep);
283
+ rb_scan_args(argc, argv, "02", (VALUE *) &roffset, (VALUE *) &rstep);
284
284
 
285
285
  ca_allocate(ca);
286
286
 
@@ -376,11 +376,11 @@ rb_ca_seq2 (VALUE self, int n, VALUE *args)
376
376
 
377
377
 
378
378
  void
379
- ca_swap_bytes (char *ptr, int32_t bytes, int32_t elements)
379
+ ca_swap_bytes (char *ptr, ca_size_t bytes, ca_size_t elements)
380
380
  {
381
381
  char *p;
382
382
  char val;
383
- int32_t i;
383
+ ca_size_t i;
384
384
 
385
385
  #define SWAP_BYTE(a, b) (val = (a), (a) = (b), (b) = val)
386
386
 
@@ -568,7 +568,7 @@ rb_ca_swap_bytes (VALUE self)
568
568
  boolean8_t *m = (ca->mask) ? (boolean8_t*) ca->mask->ptr : NULL; \
569
569
  type min = (type) from(rmin); \
570
570
  type max = (type) from(rmax); \
571
- int32_t i; \
571
+ ca_size_t i; \
572
572
  if ( m && rfval == CA_UNDEF) { \
573
573
  for (i=ca->elements; i; i--, ptr++, m++) { \
574
574
  if ( ! *m ) { \
@@ -579,7 +579,7 @@ rb_ca_swap_bytes (VALUE self)
579
579
  } \
580
580
  else { \
581
581
  int has_fill = ! ( NIL_P(rfval) ); \
582
- type fill = (has_fill) ? from(rfval) : (type) 0; \
582
+ type fill = (has_fill) ? (type) from(rfval) : (type) 0; \
583
583
  if ( m ) { \
584
584
  for (i=ca->elements; i; i--, ptr++) { \
585
585
  if ( ! *m++ ) { \
@@ -624,7 +624,7 @@ rb_ca_trim_bang (int argc, VALUE *argv, VALUE self)
624
624
 
625
625
  Data_Get_Struct(self, CArray, ca);
626
626
 
627
- rb_scan_args(argc, argv, "21", &rmin, &rmax, &rfval);
627
+ rb_scan_args(argc, argv, "21", (VALUE *) &rmin, (VALUE *) &rmax, (VALUE *) &rfval);
628
628
 
629
629
  if ( rfval == CA_UNDEF ) {
630
630
  ca_create_mask(ca);
@@ -633,10 +633,10 @@ rb_ca_trim_bang (int argc, VALUE *argv, VALUE self)
633
633
  ca_attach(ca);
634
634
 
635
635
  switch ( ca->data_type ) {
636
- case CA_INT8: proc_trim_bang(int8_t, NUM2LONG); break;
637
- case CA_UINT8: proc_trim_bang(uint8_t, NUM2ULONG); break;
638
- case CA_INT16: proc_trim_bang(int16_t, NUM2LONG); break;
639
- case CA_UINT16: proc_trim_bang(uint16_t, NUM2LONG); break;
636
+ case CA_INT8: proc_trim_bang(int8_t, NUM2INT); break;
637
+ case CA_UINT8: proc_trim_bang(uint8_t, NUM2UINT); break;
638
+ case CA_INT16: proc_trim_bang(int16_t, NUM2INT); break;
639
+ case CA_UINT16: proc_trim_bang(uint16_t, NUM2INT); break;
640
640
  case CA_INT32: proc_trim_bang(int32_t, NUM2LONG); break;
641
641
  case CA_UINT32: proc_trim_bang(uint32_t, NUM2LONG); break;
642
642
  case CA_INT64: proc_trim_bang(int64_t, NUM2LONG); break;