Message145377
> Ok, updated patch.
"ret = ~mask + 1;" looks wrong: (~0xFFFFFF80+1) gives 128, not 127. I don't see why you need:
+ if (ret < 128)
+ return 127;
+ if (ret < 256)
+ return 255;
#undef ASCII_CHAR_MASK should be #undef UCS1_ASCII_CHAR_MASK
#error Invalid STRINGLIB_SIZEOF_CHAR (must be 1, 2 or 4)
should be
#error Invalid STRINGLIB_SIZEOF_CHAR (must be 2 or 4)
Why do you need these forward declarations? It's maybe related to another patch?
static PyObject *
+unicode_fromascii(const unsigned char *s, Py_ssize_t size);
+static PyObject *
+_PyUnicode_FromUCS1(const unsigned char *s, Py_ssize_t size);
+static PyObject *
+_PyUnicode_FromUCS2(const Py_UCS2 *s, Py_ssize_t size);
+static PyObject *
+_PyUnicode_FromUCS4(const Py_UCS4 *s, Py_ssize_t size);
(You kept Py_UCS4 for "Py_UCS4 bits", but Py_UCS4 is maybe just fine.)
By the way, your function rocks :-) Use bit masks is a great idea, especially your "bits = p[0] | p[1] | p[2] | p[3]" "hack". |
|
Date |
User |
Action |
Args |
2011-10-12 00:11:45 | vstinner | set | recipients:
+ vstinner, pitrou |
2011-10-12 00:11:45 | vstinner | set | messageid: <1318378305.18.0.54202768.issue13155@psf.upfronthosting.co.za> |
2011-10-12 00:11:44 | vstinner | link | issue13155 messages |
2011-10-12 00:11:44 | vstinner | create | |
|