comparison mercurial/cext/parsers.c @ 33944:f4433f2713d0

encoding: add function to test if a str consists of ASCII characters Most strings are ASCII. Let's optimize for it. Using uint64_t is slightly faster than uint32_t on 64bit system, but there isn't huge difference.
author Yuya Nishihara <yuya@tcha.org>
date Sun, 23 Apr 2017 12:59:42 +0900
parents 2c37f9dabc32
children b90e8da190da
comparison
equal deleted inserted replaced
33943:2c37f9dabc32 33944:f4433f2713d0
694 "create a set containing non-normal and other parent entries of given " 694 "create a set containing non-normal and other parent entries of given "
695 "dirstate\n"}, 695 "dirstate\n"},
696 {"parse_manifest", parse_manifest, METH_VARARGS, "parse a manifest\n"}, 696 {"parse_manifest", parse_manifest, METH_VARARGS, "parse a manifest\n"},
697 {"parse_dirstate", parse_dirstate, METH_VARARGS, "parse a dirstate\n"}, 697 {"parse_dirstate", parse_dirstate, METH_VARARGS, "parse a dirstate\n"},
698 {"parse_index2", parse_index2, METH_VARARGS, "parse a revlog index\n"}, 698 {"parse_index2", parse_index2, METH_VARARGS, "parse a revlog index\n"},
699 {"isasciistr", isasciistr, METH_VARARGS, "check if an ASCII string\n"},
699 {"asciilower", asciilower, METH_VARARGS, "lowercase an ASCII string\n"}, 700 {"asciilower", asciilower, METH_VARARGS, "lowercase an ASCII string\n"},
700 {"asciiupper", asciiupper, METH_VARARGS, "uppercase an ASCII string\n"}, 701 {"asciiupper", asciiupper, METH_VARARGS, "uppercase an ASCII string\n"},
701 {"dict_new_presized", dict_new_presized, METH_VARARGS, 702 {"dict_new_presized", dict_new_presized, METH_VARARGS,
702 "construct a dict with an expected size\n"}, 703 "construct a dict with an expected size\n"},
703 {"make_file_foldmap", make_file_foldmap, METH_VARARGS, 704 {"make_file_foldmap", make_file_foldmap, METH_VARARGS,
714 715
715 void dirs_module_init(PyObject *mod); 716 void dirs_module_init(PyObject *mod);
716 void manifest_module_init(PyObject *mod); 717 void manifest_module_init(PyObject *mod);
717 void revlog_module_init(PyObject *mod); 718 void revlog_module_init(PyObject *mod);
718 719
719 static const int version = 2; 720 static const int version = 3;
720 721
721 static void module_init(PyObject *mod) 722 static void module_init(PyObject *mod)
722 { 723 {
723 PyModule_AddIntConstant(mod, "version", version); 724 PyModule_AddIntConstant(mod, "version", version);
724 725