[issue14419] Faster ascii decoding

Serhiy Storchaka report at bugs.python.org
Tue Mar 27 08:32:29 CEST 2012


Serhiy Storchaka <storchaka at gmail.com> added the comment:

> +#if SIZEOF_LONG <= SIZEOF_VOID_P
> +    if (!((size_t) p & LONG_PTR_MASK)) {
> 
> I wrote "q", not "p". You have to check p and q alignement to be able
> to dereference p and q pointers.

Initial q (destination) is always pointer-aligned, because PyASCIIObject is 
pointer-aligned. If PyASCIIObject not aligned, then on this platform alignment 
does not matter. But initial p (source) can be non-aligned. If the initial p 
and q are not equally aligned, then they will not be able to be aligned in the 
future, and the whole loop shall be omitted.

> sizeof(long) <= sizeof(void*) is always true.

Some memory models in I8086 processor had a 4-byte long and a 2-byte pointer. 
It is already in the past, but some modern processors can be 8-byte long and a 
4-byte pointer. I do not know, whether there are such. If you think this 
condition is unnecessary, we can remove it.

----------

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


More information about the Python-bugs-list mailing list