File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -50,6 +50,10 @@ cdef extern from *:
50
50
"""
51
51
52
52
cdef extern from " flint/flint.h" :
53
+ """
54
+ #define SIZEOF_ULONG sizeof(ulong)
55
+ """
56
+ int SIZEOF_ULONG
53
57
const char * FLINT_VERSION
54
58
const int __FLINT_RELEASE
55
59
const int FLINT_BITS
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ from flint.types.fmpz_vec cimport fmpz_vec
14
14
15
15
from flint.types.nmod cimport nmod
16
16
17
- from flint.flintlib.flint cimport FLINT_BITS
17
+ from flint.flintlib.flint cimport SIZEOF_ULONG
18
18
from flint.flintlib.fmpz cimport fmpz_set
19
19
from flint.flintlib.nmod_mpoly cimport (
20
20
nmod_mpoly_add,
@@ -696,7 +696,7 @@ cdef class nmod_mpoly(flint_mpoly):
696
696
cdef:
697
697
# Using sizeof(ulong ) here breaks on 64 windows machines because of the `ctypedef unsigned long ulong` in
698
698
# flintlib/flint.pxd. Cython will inline this definition and then allocate the wrong amount of memory.
699
- ulong *vals = < ulong * > libc.stdlib.malloc(nargs * (FLINT_BITS // 4 ) )
699
+ ulong *vals = < ulong * > libc.stdlib.malloc(nargs * SIZEOF_ULONG )
700
700
ulong res
701
701
if vals is NULL:
702
702
raise MemoryError("malloc returned a null pointer") # pragma: no cover
You can’t perform that action at this time.
0 commit comments