igrigorik-bloomfilter 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/ext/sbloomfilter.c +21 -36
  2. metadata +1 -1
@@ -80,42 +80,27 @@ static VALUE bf_s_new(int argc, VALUE *argv, VALUE self) {
80
80
 
81
81
  obj = Data_Make_Struct(self, struct BloomFilter, NULL, bits_free, bf);
82
82
 
83
- if (argc == 5) {
84
- arg1 = argv[0];
85
- arg2 = argv[1];
86
- arg3 = argv[2];
87
- arg4 = argv[3];
88
- arg5 = argv[4];
89
- } else if (argc == 4) {
90
- arg1 = argv[0];
91
- arg2 = argv[1];
92
- arg3 = argv[2];
93
- arg4 = argv[3];
94
- arg5 = 0;
95
- } else if (argc == 3) {
96
- arg1 = argv[0];
97
- arg2 = argv[1];
98
- arg3 = argv[2];
99
- arg4 = INT2FIX(1);
100
- arg5 = 0;
101
- } else if (argc == 2) {
102
- arg1 = argv[0];
103
- arg2 = argv[1];
104
- arg3 = INT2FIX(0);
105
- arg4 = INT2FIX(1);
106
- arg5 = 0;
107
- } else if (argc == 1) {
108
- arg1 = argv[0];
109
- arg2 = INT2FIX(4);
110
- arg3 = INT2FIX(0);
111
- arg4 = INT2FIX(1);
112
- arg5 = 0;
113
- } else { /* default = Fugou approach :-) */
114
- arg1 = INT2FIX(100000000);
115
- arg2 = INT2FIX(4);
116
- arg3 = INT2FIX(0);
117
- arg4 = INT2FIX(1);
118
- arg5 = 0;
83
+ /* default = Fugou approach :-) */
84
+ arg1 = INT2FIX(100000000);
85
+ arg2 = INT2FIX(4);
86
+ arg3 = INT2FIX(0);
87
+ arg4 = INT2FIX(1);
88
+ arg5 = INT2FIX(0);
89
+
90
+ switch (argc) {
91
+ case 5:
92
+ if (argv[4] == Qtrue) {
93
+ arg5 = INT2FIX(1);
94
+ }
95
+ case 4:
96
+ arg4 = argv[3];
97
+ case 3:
98
+ arg3 = argv[2];
99
+ case 2:
100
+ arg2 = argv[1];
101
+ case 1:
102
+ arg1 = argv[0];
103
+ break;
119
104
  }
120
105
 
121
106
  m = FIX2INT(arg1);
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: igrigorik-bloomfilter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ilya Grigorik