[Python-Dev] Fixes for imageop module (original) (raw)

Sjoerd Mullender sjoerd at acm.org
Fri Dec 26 18:09:39 EST 2003


Guido van Rossum wrote:

I have some fixes for the imageop module to make it work on systems with a different byte-order than IRIX (e.g. Linux). Shall I check them in or is it not worth it for such an old module? Anything else that needs to be changed when I check this in? The fixes of course will result in different results on Linux than before, so that's the main reason for asking.

I don't see imageop in the list of deprecated modules in PEP 4, and apparently you are still using it, so as long as you don't mind being potentially the sole maintainer and user, I don't mind these being in the distribution. What do you mean by different results on Linux? Was this module previously doing something bogus there? --Guido van Rossum (home page: http://www.python.org/~guido/)

The main difference is:


*** 570,577 **** r = (r<<5) | (r<<3) | (r>>1); g = (g<<5) | (g<<3) | (g>>1); b = (b<<6) | (b<<4) | (b<<2) | b; ! nvalue = r | (g<<8) | (b<<16); ! *ncp++ = nvalue; } return rv; } --- 560,569 ---- r = (r<<5) | (r<<3) | (r>>1); g = (g<<5) | (g<<3) | (g>>1); b = (b<<6) | (b<<4) | (b<<2) | b; ! *ncp++ = 0; ! *ncp++ = b; ! *ncp++ = g; ! *ncp++ = r; } return rv; }

where the old ncp is an "Py_UInt32 *" and the new ncp is an "unsigned char *". This results in different byte ordering on a little endian machine such as Intel.

-- Sjoerd Mullender <sjoerd at acm.org>



More information about the Python-Dev mailing list