On Thu, 06 Oct 2011 17:52:05 +0200 Victor Stinner <victor.stin...@haypocalc.com> wrote: > index << (kind - 1) and index * PyUnicode_CHARACTER_SIZE(str) were used > in unicodeobject.c. It's not easy to understand this formula
index * PyUnicode_CHARACTER_SIZE(str) is quite easy to understand to me. I find it less cryptic than PyUnicode_KIND_SIZE(kind, index), actually, and I would advocate using the former and removing the latter. > (PyUnicode_KIND_SIZE() is also a micro-optimization, it uses shift > instead of multiply.) I don't know, but I think the compiler should be able to do that for you. Also, I don't think PyUnicode_KIND_SIZE would be used in a critical loop. You would use PyUnicode_READ when doing one-character-at-a-time stuff. Regards Antoine. _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com