primesieve 1.1.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/ext/primesieve/extconf.rb +0 -9
- data/ext/primesieve/primesieve-ruby.c +0 -58
- data/lib/primesieve.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: ab19dd75a63535e8a006a7e8cefd9265ea41c9be5cc5f21521a767791772835f
|
4
|
+
data.tar.gz: f39d6038912187aa421e14dbb783ef57ea0eb1bb6915b145bf5f1a5580c4501a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ce596071856082da3262f2d5e862315785ece4bc8dd015e0b59f3a8d767af13e9a273349b047011ae0f975fc83fd00acc30aa45704de9f06b5bf4c951bcd7b6
|
7
|
+
data.tar.gz: de4872169e1232f4486c0da711bf565c974439f2c18e2bdb67e61b5812d81428beefeb4b971c4e6156ddd817056df912d6f8a37a76d28eeff6309b7701e413c2
|
data/ext/primesieve/extconf.rb
CHANGED
@@ -21,32 +21,23 @@ fns = [
|
|
21
21
|
'primesieve_generate_primes',
|
22
22
|
'primesieve_generate_n_primes',
|
23
23
|
'primesieve_nth_prime',
|
24
|
-
'primesieve_parallel_nth_prime',
|
25
24
|
'primesieve_count_primes',
|
26
25
|
'primesieve_count_twins',
|
27
26
|
'primesieve_count_triplets',
|
28
27
|
'primesieve_count_quadruplets',
|
29
28
|
'primesieve_count_quintuplets',
|
30
29
|
'primesieve_count_sextuplets',
|
31
|
-
'primesieve_parallel_count_primes',
|
32
|
-
'primesieve_parallel_count_twins',
|
33
|
-
'primesieve_parallel_count_triplets',
|
34
|
-
'primesieve_parallel_count_quadruplets',
|
35
|
-
'primesieve_parallel_count_quintuplets',
|
36
|
-
'primesieve_parallel_count_sextuplets',
|
37
30
|
'primesieve_print_primes',
|
38
31
|
'primesieve_print_twins',
|
39
32
|
'primesieve_print_triplets',
|
40
33
|
'primesieve_print_quadruplets',
|
41
34
|
'primesieve_print_quintuplets',
|
42
35
|
'primesieve_print_sextuplets',
|
43
|
-
'primesieve_callback_primes',
|
44
36
|
'primesieve_get_sieve_size',
|
45
37
|
'primesieve_get_num_threads',
|
46
38
|
'primesieve_get_max_stop',
|
47
39
|
'primesieve_set_sieve_size',
|
48
40
|
'primesieve_set_num_threads',
|
49
|
-
'primesieve_test'
|
50
41
|
]
|
51
42
|
|
52
43
|
unless find_header('primesieve.h')
|
@@ -28,10 +28,6 @@ static VALUE nth_prime(VALUE self, VALUE n, VALUE start) {
|
|
28
28
|
return ULL2NUM(primesieve_nth_prime(NUM2LL(n), NUM2ULL(start)));
|
29
29
|
}
|
30
30
|
|
31
|
-
static VALUE parallel_nth_prime(VALUE self, VALUE n, VALUE start) {
|
32
|
-
return ULL2NUM(primesieve_parallel_nth_prime(NUM2LL(n), NUM2ULL(start)));
|
33
|
-
}
|
34
|
-
|
35
31
|
static VALUE count_primes(VALUE self, VALUE start, VALUE stop) {
|
36
32
|
return ULL2NUM(primesieve_count_primes(NUM2ULL(start), NUM2ULL(stop)));
|
37
33
|
}
|
@@ -56,30 +52,6 @@ static VALUE count_sextuplets(VALUE self, VALUE start, VALUE stop) {
|
|
56
52
|
return ULL2NUM(primesieve_count_sextuplets(NUM2ULL(start), NUM2ULL(stop)));
|
57
53
|
}
|
58
54
|
|
59
|
-
static VALUE parallel_count_primes(VALUE self, VALUE start, VALUE stop) {
|
60
|
-
return ULL2NUM(primesieve_parallel_count_primes(NUM2ULL(start), NUM2ULL(stop)));
|
61
|
-
}
|
62
|
-
|
63
|
-
static VALUE parallel_count_twins(VALUE self, VALUE start, VALUE stop) {
|
64
|
-
return ULL2NUM(primesieve_parallel_count_twins(NUM2ULL(start), NUM2ULL(stop)));
|
65
|
-
}
|
66
|
-
|
67
|
-
static VALUE parallel_count_triplets(VALUE self, VALUE start, VALUE stop) {
|
68
|
-
return ULL2NUM(primesieve_parallel_count_triplets(NUM2ULL(start), NUM2ULL(stop)));
|
69
|
-
}
|
70
|
-
|
71
|
-
static VALUE parallel_count_quadruplets(VALUE self, VALUE start, VALUE stop) {
|
72
|
-
return ULL2NUM(primesieve_parallel_count_quadruplets(NUM2ULL(start), NUM2ULL(stop)));
|
73
|
-
}
|
74
|
-
|
75
|
-
static VALUE parallel_count_quintuplets(VALUE self, VALUE start, VALUE stop) {
|
76
|
-
return ULL2NUM(primesieve_parallel_count_quintuplets(NUM2ULL(start), NUM2ULL(stop)));
|
77
|
-
}
|
78
|
-
|
79
|
-
static VALUE parallel_count_sextuplets(VALUE self, VALUE start, VALUE stop) {
|
80
|
-
return ULL2NUM(primesieve_parallel_count_sextuplets(NUM2ULL(start), NUM2ULL(stop)));
|
81
|
-
}
|
82
|
-
|
83
55
|
static VALUE print_primes(VALUE self, VALUE start, VALUE stop) {
|
84
56
|
primesieve_print_primes(NUM2ULL(start), NUM2ULL(stop));
|
85
57
|
return Qnil;
|
@@ -110,23 +82,6 @@ static VALUE print_sextuplets(VALUE self, VALUE start, VALUE stop) {
|
|
110
82
|
return Qnil;
|
111
83
|
}
|
112
84
|
|
113
|
-
static void callback_fn(uint64_t prime) {
|
114
|
-
rb_yield(ULL2NUM(prime));
|
115
|
-
return;
|
116
|
-
}
|
117
|
-
|
118
|
-
static VALUE callback_primes(VALUE self, VALUE start, VALUE stop) {
|
119
|
-
if (!rb_block_given_p())
|
120
|
-
rb_raise(rb_eArgError, "Expected block");
|
121
|
-
primesieve_callback_primes(NUM2ULL(start), NUM2ULL(stop), callback_fn);
|
122
|
-
return Qnil;
|
123
|
-
}
|
124
|
-
|
125
|
-
static void parallel_callback_fn(uint64_t prime, int thread_id) {
|
126
|
-
rb_yield_values(2, ULL2NUM(prime), INT2NUM(thread_id));
|
127
|
-
return;
|
128
|
-
}
|
129
|
-
|
130
85
|
static VALUE get_sieve_size(VALUE self) {
|
131
86
|
return INT2NUM(primesieve_get_sieve_size());
|
132
87
|
}
|
@@ -149,40 +104,27 @@ static VALUE set_num_threads(VALUE self, VALUE num_threads) {
|
|
149
104
|
return Qnil;
|
150
105
|
}
|
151
106
|
|
152
|
-
static VALUE test(VALUE self) {
|
153
|
-
return INT2NUM(primesieve_test());
|
154
|
-
}
|
155
|
-
|
156
107
|
void Init_primesieve() {
|
157
108
|
mPrimesieve = rb_define_module("Primesieve");
|
158
109
|
|
159
110
|
rb_define_module_function(mPrimesieve, "generate_primes", generate_primes, 2);
|
160
111
|
rb_define_module_function(mPrimesieve, "generate_n_primes", generate_n_primes, 2);
|
161
112
|
rb_define_module_function(mPrimesieve, "nth_prime", nth_prime, 2);
|
162
|
-
rb_define_module_function(mPrimesieve, "parallel_nth_prime", parallel_nth_prime, 2);
|
163
113
|
rb_define_module_function(mPrimesieve, "count_primes", count_primes, 2);
|
164
114
|
rb_define_module_function(mPrimesieve, "count_twins", count_twins, 2);
|
165
115
|
rb_define_module_function(mPrimesieve, "count_triplets", count_triplets, 2);
|
166
116
|
rb_define_module_function(mPrimesieve, "count_quadruplets", count_quadruplets, 2);
|
167
117
|
rb_define_module_function(mPrimesieve, "count_quintuplets", count_quintuplets, 2);
|
168
118
|
rb_define_module_function(mPrimesieve, "count_sextuplets", count_sextuplets, 2);
|
169
|
-
rb_define_module_function(mPrimesieve, "parallel_count_primes", parallel_count_primes, 2);
|
170
|
-
rb_define_module_function(mPrimesieve, "parallel_count_twins", parallel_count_twins, 2);
|
171
|
-
rb_define_module_function(mPrimesieve, "parallel_count_triplets", parallel_count_triplets, 2);
|
172
|
-
rb_define_module_function(mPrimesieve, "parallel_count_quadruplets", parallel_count_quadruplets, 2);
|
173
|
-
rb_define_module_function(mPrimesieve, "parallel_count_quintuplets", parallel_count_quintuplets, 2);
|
174
|
-
rb_define_module_function(mPrimesieve, "parallel_count_sextuplets", parallel_count_sextuplets, 2);
|
175
119
|
rb_define_module_function(mPrimesieve, "print_primes", print_primes, 2);
|
176
120
|
rb_define_module_function(mPrimesieve, "print_twins", print_twins, 2);
|
177
121
|
rb_define_module_function(mPrimesieve, "print_triplets", print_triplets, 2);
|
178
122
|
rb_define_module_function(mPrimesieve, "print_quadruplets", print_quadruplets, 2);
|
179
123
|
rb_define_module_function(mPrimesieve, "print_quintuplets", print_quintuplets, 2);
|
180
124
|
rb_define_module_function(mPrimesieve, "print_sextuplets", print_sextuplets, 2);
|
181
|
-
rb_define_module_function(mPrimesieve, "callback_primes", callback_primes, 2);
|
182
125
|
rb_define_module_function(mPrimesieve, "get_sieve_size", get_sieve_size, 0);
|
183
126
|
rb_define_module_function(mPrimesieve, "get_num_threads", get_num_threads, 0);
|
184
127
|
rb_define_module_function(mPrimesieve, "get_max_stop", get_max_stop, 0);
|
185
128
|
rb_define_module_function(mPrimesieve, "set_sieve_size", set_sieve_size, 1);
|
186
129
|
rb_define_module_function(mPrimesieve, "set_num_threads", set_num_threads, 1);
|
187
|
-
rb_define_module_function(mPrimesieve, "test", test, 0);
|
188
130
|
}
|
data/lib/primesieve.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: primesieve
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Looby
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-10-18 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A wrapper for the primesieve C prime number generator
|
14
14
|
email: robertjlooby@gmail.com
|
@@ -40,8 +40,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
version: '0'
|
42
42
|
requirements: []
|
43
|
-
|
44
|
-
rubygems_version: 2.4.4
|
43
|
+
rubygems_version: 3.0.3
|
45
44
|
signing_key:
|
46
45
|
specification_version: 4
|
47
46
|
summary: A wrapper for the primesieve lib
|