[Numpy-discussion] Int bitsize in python and c

Dag Sverre Seljebotn dagss@student.matnat.uio...
Thu Mar 18 09:25:39 CDT 2010


Martin Raspaud wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hello,
>
> I work on a 64bit machine with 64bits enable fedora on it.
>
> I just discovered that numpy.int on the python part are 64bits ints, while
> npy_int in the C api are 32bits ints.
>   

np.intc

Dag Sverre

> I can live with it, but it seems to be different on 32bit machines, hence I
> wonder what is the right way to do when retrieving an array from python to C.
>
> Here is what I use now:
> data_pyarray = (PyArrayObject *)PyArray_ContiguousFromObject(data_list,
> PyArray_INT, 1, 2);
>
> but that implies that I send np.int32 arrays to the C part.
>
> Should I use longs instead ?
>
> Regards,
> Martin
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (GNU/Linux)
> Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/
>
> iQEcBAEBAgAGBQJLoiuqAAoJEBdvyODiyJI4TikIAIUpnsIxxeYMlz8qEeZL/UUB
> 3UTGOCcrcIICPVRW/CLbOss5W4xe8BTxPslRXZfckSuMMgHHiD3rGC302gZgfvsb
> mS6fcDzTOboJ1da1xoczpJYVCwvC9aWAPEjEDa6jyI331pDAXABurmjzIQqjowDw
> 1cWX5swt9MeSn0yOa/a2EYQP8Xj+n0RQlSIutEDR5jktlK3yyHX8LAtZd0tAPgrd
> hr9RGwO09Hwcn7ke4B9SwHF7Zg/mBrHgdTdaufW+kjPleZ479lyMO8r/LsWbehVo
> usQ5wefnmnzhDhOoxff8aKUo8D+Ne8gqxI4BR5EOAdHfQ2uUPpBA91pJ0cNbzZI=
> =E0XH
> -----END PGP SIGNATURE-----
>   
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>   



More information about the NumPy-Discussion mailing list