mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
Add asciilib: similar to ucs1, ucs2 and ucs4 library, but specialized to ASCII
ucs1, ucs2 and ucs4 libraries have to scan created substring to find the maximum character, whereas it is not need to ASCII strings. Because ASCII strings are common, it is useful to optimize ASCII.
This commit is contained in:
parent
14f8f02826
commit
c3cec7868b
4 changed files with 153 additions and 49 deletions
|
@ -501,7 +501,7 @@ calc_number_widths(NumberFieldWidths *spec, Py_ssize_t n_prefix,
|
|||
spec->n_grouped_digits = 0;
|
||||
else
|
||||
spec->n_grouped_digits = _PyUnicode_InsertThousandsGrouping(
|
||||
PyUnicode_1BYTE_KIND, NULL, 0, NULL,
|
||||
NULL, PyUnicode_1BYTE_KIND, NULL, 0, NULL,
|
||||
spec->n_digits, spec->n_min_width,
|
||||
locale->grouping, locale->thousands_sep);
|
||||
|
||||
|
@ -603,7 +603,7 @@ fill_number(PyObject *out, Py_ssize_t pos, const NumberFieldWidths *spec,
|
|||
r =
|
||||
#endif
|
||||
_PyUnicode_InsertThousandsGrouping(
|
||||
kind,
|
||||
out, kind,
|
||||
(char*)data + PyUnicode_KIND_SIZE(kind, pos),
|
||||
spec->n_grouped_digits,
|
||||
pdigits + PyUnicode_KIND_SIZE(kind, d_pos),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue