[pypy-dev] cffi python long
Armin Rigo
arigo at tunes.org
Fri Nov 8 16:59:57 CET 2013
Hi Nathan,
On Fri, Nov 8, 2013 at 4:35 PM, Amaury Forgeot d'Arc <amauryfa at gmail.com> wrote:
>> Is there a nicer way to pass python long ints (bigint) into C
>> efficiently?
It depends what the C code wants to do with it. If it's just for
passing around, you can use ffi.from_handle(). If the C code expects
to read the value, then I fear you need to decompose it into some
format, either manually or using hex() or marshal. The internal
format of longs in PyPy is not directly accessible: it is not using
64-bit integers, but 63-bit if the C compiler supports __int128_t and
31-bit otherwise.
A bientôt,
Armin.
More information about the pypy-dev
mailing list