[issue14249] unicodeobject.c: aliasing warnings

STINNER Victor report at bugs.python.org
Tue Mar 20 15:04:48 CET 2012


STINNER Victor <victor.stinner at gmail.com> added the comment:

> With my patch (attached) codecs.utf_16_be_decode runs 5% faster (on 32-bit Linux, I was not tested 64-bit). And of cause no pointers -- no aliasing warnings.

Your patch is wrong: you need to use & 0xffff to get lower 16 bits
when reading a UTF-16 unit. For example, (Py_UCS2)(block >> 32) should
be written (Py_UCS2)((block >> 32) & 0xffff).

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14249>
_______________________________________


More information about the Python-bugs-list mailing list