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 *:
5050 """
5151
5252cdef extern from " flint/flint.h" :
53+ """
54+ #define SIZEOF_ULONG sizeof(ulong)
55+ """
56+ int SIZEOF_ULONG
5357 const char * FLINT_VERSION
5458 const int __FLINT_RELEASE
5559 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
1414
1515from flint.types.nmod cimport nmod
1616
17- from flint.flintlib.flint cimport FLINT_BITS
17+ from flint.flintlib.flint cimport SIZEOF_ULONG
1818from flint.flintlib.fmpz cimport fmpz_set
1919from flint.flintlib.nmod_mpoly cimport (
2020 nmod_mpoly_add,
@@ -696,7 +696,7 @@ cdef class nmod_mpoly(flint_mpoly):
696696 cdef:
697697 # Using sizeof(ulong ) here breaks on 64 windows machines because of the `ctypedef unsigned long ulong` in
698698 # 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 )
700700 ulong res
701701 if vals is NULL:
702702 raise MemoryError("malloc returned a null pointer") # pragma: no cover
You can’t perform that action at this time.
0 commit comments