> If x is the address to a byte array as a python int, you can do
>
> cdef byte *my_bytes = <byte*><size_t>x
>
> In Cython 0.11, size_t will be a native type, but until then you can
> use Py_ssize_t instead.
>
> - Robert
When I try to build it, it tells me byte is not a type identifier.
My code is as follow, what am I doing wrong?
def fitness(int new_image, int original_image, int size):
cdef byte *new_pixels = <byte*><Py_ssize_t>size
cdef byte *original_pixels = <byte*><Py_ssize_t>size
cdef long spam = 0
cdef int i = 0
for i in range(len(new_pixels)):
spam += abs(original_pixels[i] - new_pixels[i])
return 1020 * len((original_pixels)) - spam
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev