Skip to content

Commit bc75fa5

Browse files
committed
Make sieve_cluster offsets const variables
1 parent 4f717dc commit bc75fa5

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

sieve_cluster.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ typedef struct {
3434
t_ = n1; n1 = n2; n2 = t_; \
3535
t_ = m1; m1 = m2; m2 = t_; }
3636

37-
static int is_admissible(uint32_t nc, uint32_t* cl) {
37+
static int is_admissible(uint32_t nc, const uint32_t* cl) {
3838
uint32_t i, j, c;
3939
char rset[sprimes[NSMALLPRIMES-1]];
4040

@@ -54,7 +54,7 @@ static int is_admissible(uint32_t nc, uint32_t* cl) {
5454
}
5555

5656
/* Given p prime, is this a cluster? */
57-
static int is_cluster(UV p, uint32_t nc, uint32_t* cl) {
57+
static int is_cluster(UV p, uint32_t nc, const uint32_t* cl) {
5858
uint32_t c;
5959
for (c = 1; c < nc; c++)
6060
if (!is_prob_prime(p+cl[c]))
@@ -63,7 +63,7 @@ static int is_cluster(UV p, uint32_t nc, uint32_t* cl) {
6363
}
6464

6565
/* This is fine for small ranges. Low overhead. */
66-
UV* sieve_cluster_simple(UV beg, UV end, uint32_t nc, uint32_t* cl, UV* numret)
66+
UV* sieve_cluster_simple(UV beg, UV end, uint32_t nc, const uint32_t* cl, UV* numret)
6767
{
6868
vlist retlist;
6969

@@ -108,7 +108,7 @@ UV* sieve_cluster_simple(UV beg, UV end, uint32_t nc, uint32_t* cl, UV* numret)
108108

109109
#define addmodded(r,a,b,n) do { r = a + b; if (r >= n) r -= n; } while(0)
110110

111-
UV* sieve_cluster(UV low, UV high, uint32_t nc, uint32_t* cl, UV* numret)
111+
UV* sieve_cluster(UV low, UV high, uint32_t nc, const uint32_t* cl, UV* numret)
112112
{
113113
vlist retlist;
114114
UV i, ppr, nres, allocres;

sieve_cluster.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
#include "ptypes.h"
55

6-
extern UV* sieve_cluster_simple(UV beg, UV end, uint32_t nc, uint32_t* cl, UV* numret);
7-
extern UV* sieve_cluster(UV beg, UV end, uint32_t nc, uint32_t* cl, UV* numret);
6+
extern UV* sieve_cluster_simple(UV beg, UV end, uint32_t nc, const uint32_t* cl, UV* numret);
7+
extern UV* sieve_cluster(UV beg, UV end, uint32_t nc, const uint32_t* cl, UV* numret);
88

99
#endif

0 commit comments

Comments
 (0)