Re: [pypy-dev] cffi python long

2013-11-08 Thread Armin Rigo
Hi Nathan, On Fri, Nov 8, 2013 at 4:35 PM, Amaury Forgeot d'Arc 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

Re: [pypy-dev] cffi python long

2013-11-08 Thread Amaury Forgeot d'Arc
2013/11/8 Nathan Hurst > Is there a nicer way to pass python long ints (bigint) into C > efficiently? I'm currently cutting the value up into 64 bit chunks in > python and passing in as an unsigned long*: > > cdef("int bigInt(int n, unsigned long* x);") > > x = sum(1 << i for i in [100,200,123])

[pypy-dev] cffi python long

2013-11-08 Thread Nathan Hurst
Is there a nicer way to pass python long ints (bigint) into C efficiently? I'm currently cutting the value up into 64 bit chunks in python and passing in as an unsigned long*: cdef("int bigInt(int n, unsigned long* x);") x = sum(1 << i for i in [100,200,123]) xs = [] while x > 0: xs.append(x