Hi! On 26 Jul., 11:09, Jeroen Demeyer <jdeme...@cage.ugent.be> wrote: > More concretely: in the pari source file src/headers/parigen.h, there is > #define lgefint(x) ((long)(((ulong*)(x))[1] & LGBITS)) > > But in Sage, in sage/libs/pari/decl.pxi, there is > long lgefint(GEN x)
To my understanding, it is the correct way. "#define ..." means that lgefint(...) is replaced by ((long)(((ulong*) (...))[1] & LGBITS)) in all C-files including that header. This also holds for the C-files generated by Cython. Nonetheless, Cython needs to know what argument type and type of output to expect. Therefore, one has "long lgefint(GEN x)" in the Cython header. It works (at least for me). I admit that it somehow looks wrong, and indeed it results in a compiler (or linker?) warning. Probably one "clean" way of usage would be to define a proper function that wraps the macro. There might be a penalty for calling that function, though (or am I mistaken that using a macro is slightly faster than using a function of the same content, but results in a bigger .so file?). Cheers, Simon -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org