> Use "char", not "byte".

Of course, you are right. However now it crashes the Python
interpreter when called.

Current code:

def fitness(int new_image, int original_image, int size):

    cdef unsigned char *new_pixels = <unsigned char*><Py_ssize_t>size
    cdef unsigned char *original_pixels = <unsigned char*><Py_ssize_t>size

    cdef long spam = 0
    cdef int i = 0
    for i in range(size):
        spam += abs(original_pixels[i] - new_pixels[i])

    return 255 * size - spam
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to