-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make Sage a run-time dependency not a build-time dependency
- Loading branch information
Showing
4 changed files
with
37 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,9 @@ | ||
include "fpylll/config.pxi" | ||
|
||
from cpython.int cimport PyInt_AS_LONG | ||
from fplll.fplll cimport Z_NR | ||
from gmp.mpz cimport mpz_t, mpz_set_si, mpz_set | ||
from gmp.mpz cimport mpz_t | ||
from gmp.types cimport mpz_srcptr | ||
from fpylll.gmp.pylong cimport mpz_get_pyintlong, mpz_set_pylong | ||
|
||
cdef int assign_Z_NR_mpz(Z_NR[mpz_t]& t, value) except -1 | ||
|
||
IF HAVE_SAGE: | ||
from sage.rings.integer cimport Integer | ||
cdef Integer mpz_get_python(mpz_srcptr z) | ||
ELSE: | ||
from fpylll.gmp.pylong cimport mpz_get_pyintlong as mpz_get_python | ||
|
||
cdef inline int assign_mpz(mpz_t& t, value) except -1: | ||
""" | ||
Assign Python integer to Z_NR[mpz_t] | ||
""" | ||
if isinstance(value, int): | ||
mpz_set_si(t, PyInt_AS_LONG(value)) | ||
return 0 | ||
if isinstance(value, long): | ||
mpz_set_pylong(t, value) | ||
return 0 | ||
IF HAVE_SAGE: | ||
if isinstance(value, Integer): | ||
mpz_set(t, (<Integer>value).value) | ||
return 0 | ||
|
||
raise NotImplementedError("Type '%s' not supported"%type(value)) | ||
cdef int assign_mpz(mpz_t& t, value) except -1 | ||
cdef object mpz_get_python(mpz_srcptr z) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters