Skip to content

Commit

Permalink
Fix build with pari 2.17
Browse files Browse the repository at this point in the history
NEXT_PRIME_VIADIFF is removed in 2.17, port pari_prime_range to pari_PRIMES instead
  • Loading branch information
antonio-rojas committed Oct 1, 2024
1 parent d1f99d1 commit 0c5d88d
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/sage/libs/pari/convert_sage.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -573,17 +573,16 @@ cpdef list pari_prime_range(long c_start, long c_stop, bint py_ints=False):
sage: pari_prime_range(2, 19)
[2, 3, 5, 7, 11, 13, 17]
"""
cdef long p = 0
cdef byteptr pari_prime_ptr = diffptr
cdef ulong i = 1
res = []
while p < c_start:
NEXT_PRIME_VIADIFF(p, pari_prime_ptr)
while p < c_stop:
while pari_PRIMES[i] < c_start:
i+=1
while pari_PRIMES[i] < c_stop:
if py_ints:
res.append(p)
res.append(pari_PRIMES[i])
else:
z = <Integer>PY_NEW(Integer)
mpz_set_ui(z.value, p)
mpz_set_ui(z.value, pari_PRIMES[i])
res.append(z)
NEXT_PRIME_VIADIFF(p, pari_prime_ptr)
i+=1
return res

0 comments on commit 0c5d88d

Please sign in to comment.