numo-narray 0.9.1.7 → 0.9.1.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 13fa1238cfb0a52ebd9c7f067e43660316027ecf0c9f03c387f0022c0ba4dace
4
- data.tar.gz: bc4bbdb7664ae87f1be7ed302dcae63d852f09ed05dcd5a30a8f6e8368bdd2de
3
+ metadata.gz: 596c9ece21d3e9d75cf78a7b6d60b3fbda065a23718763bb3632cc8cae45fab6
4
+ data.tar.gz: bf03dd10e983d362a233bab2ec356e6a68e9dc3e27edccdf40018e661a15fe87
5
5
  SHA512:
6
- metadata.gz: bd834ddb4e45505e61d6bf81b7d4b8147228d12c3321d9fb3cc2fc8a3f51fe40e885010fc59e0a44b1f0d4b11780b2744f2b36236446dab178f91a1fb633d096
7
- data.tar.gz: 0d75394f0ce6c63329de7c8549644fa8c3c5d5ada1883a8f48175c6683cb573b507006302b64ca31e4c12d58577f1a47ff9ca3ae4237e72dac76d52be4f3d1d8
6
+ metadata.gz: 58ef93f8200db87e99012b56bd7f8ccf22cb97abc77b1596e16a855f509fab498e33859b78f6b9626347ed83769eeb9011a7d59a93b3a8527131cad657b58d17
7
+ data.tar.gz: ac72e280b35ee08eb3b9faf5880355ccdeb4f39d521ba3f9d6067e96102e55561433eff16ed0b0b512da63057dca18d8eb6d72a4687a6d75321e5c29068c70fd
@@ -30,6 +30,9 @@ static ID id_step;
30
30
  static ID id_abs;
31
31
  static ID id_cast;
32
32
  static ID id_le;
33
+ #if SIZEOF_LONG <= 4
34
+ static ID id_ge;
35
+ #endif
33
36
  static ID id_Complex;
34
37
  static VALUE int32_max = Qnil;
35
38
  static VALUE int32_min = Qnil;
@@ -45,7 +48,7 @@ static VALUE
45
48
  return NA_BIT;
46
49
  return type;
47
50
 
48
- #if SIZEOF_LONG == 4
51
+ #if SIZEOF_LONG <= 4
49
52
  case T_FIXNUM:
50
53
  if (type<NA_INT32)
51
54
  return NA_INT32;
@@ -61,12 +64,11 @@ static VALUE
61
64
  }
62
65
  }
63
66
  return type;
64
-
65
- #elif SIZEOF_LONG == 8
67
+ #else
66
68
  case T_FIXNUM:
67
69
  if (type<NA_INT64) {
68
70
  long x = NUM2LONG(v);
69
- if (x<=2147483647 && x>=-2147483648) {
71
+ if (x<=2147483647L && x>=-2147483648L) {
70
72
  if (type<NA_INT32)
71
73
  return NA_INT32;
72
74
  } else {
@@ -78,19 +80,6 @@ static VALUE
78
80
  if (type<NA_INT64)
79
81
  return NA_INT64;
80
82
  return type;
81
- #else
82
- case T_FIXNUM:
83
- case T_BIGNUM:
84
- if (type<NA_INT64) {
85
- if (RTEST(rb_funcall(v,id_le,1,int32_max)) &&
86
- RTEST(rb_funcall(v,id_ge,1,int32_min))) {
87
- if (type<NA_INT32)
88
- return NA_INT32;
89
- } else {
90
- return NA_INT64;
91
- }
92
- }
93
- return type;
94
83
  #endif
95
84
 
96
85
  case T_FLOAT:
@@ -645,6 +634,9 @@ Init_nary_array()
645
634
  id_cast = rb_intern("cast");
646
635
  id_abs = rb_intern("abs");
647
636
  id_le = rb_intern("<=");
637
+ #if SIZEOF_LONG <= 4
638
+ id_ge = rb_intern(">=");
639
+ #endif
648
640
  id_Complex = rb_intern("Complex");
649
641
 
650
642
  rb_global_variable(&int32_max);
@@ -8,9 +8,7 @@
8
8
  #include "numo/narray.h"
9
9
  #include "numo/template.h"
10
10
 
11
- static VALUE sym_mulsum;
12
11
  static ID id_mulsum;
13
- static ID id_respond_to_p;
14
12
  static ID id_store;
15
13
  static ID id_swap_byte;
16
14
 
@@ -921,12 +919,10 @@ na_new_dimension_for_dot(VALUE self, int pos, int len, bool transpose)
921
919
  static VALUE
922
920
  numo_na_dot(VALUE self, VALUE other)
923
921
  {
924
- VALUE test;
925
922
  volatile VALUE a1=self, a2=other;
926
923
  narray_t *na1, *na2;
927
924
 
928
- test = rb_funcall(a1, id_respond_to_p, 1, sym_mulsum);
929
- if (!RTEST(test)) {
925
+ if (!rb_respond_to(a1, id_mulsum)) {
930
926
  rb_raise(rb_eNoMethodError,"requires mulsum method for dot method");
931
927
  }
932
928
  GetNArray(a1,na1);
@@ -983,8 +979,6 @@ Init_nary_data()
983
979
  //rb_define_method(cNArray, "dot", numo_na_dot, 1);
984
980
 
985
981
  id_mulsum = rb_intern("mulsum");
986
- sym_mulsum = ID2SYM(id_mulsum);
987
- id_respond_to_p = rb_intern("respond_to?");
988
982
  id_store = rb_intern("store");
989
983
  id_swap_byte = rb_intern("swap_byte");
990
984
  }
@@ -13,8 +13,8 @@ extern "C" {
13
13
  #endif
14
14
  #endif
15
15
 
16
- #define NARRAY_VERSION "0.9.1.7"
17
- #define NARRAY_VERSION_CODE 917
16
+ #define NARRAY_VERSION "0.9.1.8"
17
+ #define NARRAY_VERSION_CODE 918
18
18
 
19
19
  #include <math.h>
20
20
  #include "numo/compat.h"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: numo-narray
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1.7
4
+ version: 0.9.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masahiro TANAKA