diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 04fec7b..384eaef 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -17,11 +17,11 @@ repos: args: [--allow-multiple-documents] - id: check-json - repo: https://github.com/pre-commit/mirrors-clang-format - rev: v21.1.6 + rev: v23.1.0 hooks: - id: clang-format - repo: https://github.com/PyCQA/pylint - rev: v4.0.4 + rev: v4.0.8 hooks: - id: pylint exclude: ^(.cmake-format.py) @@ -33,7 +33,7 @@ repos: additional_dependencies: - psutil - repo: https://github.com/codespell-project/codespell - rev: v2.4.1 + rev: v2.4.3 hooks: - id: codespell - repo: https://github.com/cheshirekow/cmake-format-precommit diff --git a/poc/int_to_string/int_to_string.h b/poc/int_to_string/int_to_string.h index 87028ce..8e4a32f 100644 --- a/poc/int_to_string/int_to_string.h +++ b/poc/int_to_string/int_to_string.h @@ -51,19 +51,18 @@ static constexpr std::uint64_t pow10[21] = {1ULL, // is floor(p * log10 2) + 1. // this table lets us obtain L from the MSB in O(1) with at most one // boundary comparison against the matching power of ten. -static constexpr std::uint8_t digit_count_lut[64] = { - // p : 0 1 2 3 | 4 5 6 | 7 8 9 | 10 11 12 13 - 1, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 4, - // p : 14 15 16 | 17 18 19 | 20 21 22 | 23 24 25 26 - 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 8, - // p : 27 28 29 | 30 31 32 | 33 34 35 36 | 37 38 - 9, 9, 9, 10, 10, 10, 11, 11, 11, 11, 12, 12, - // p : 39 40 41 42 | 43 44 45 46 | 47 48 49 - 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, - // p : 50 51 52 53 | 54 55 56 | 57 58 59 - 16, 16, 16, 16, 17, 17, 17, 18, 18, 18, - // p : 60 61 62 63 - 19, 19, 19, 19}; +static constexpr std::uint8_t digit_count_lut[64] = {// p : 0 1 2 3 | 4 5 6 | 7 8 9 | 10 11 12 13 + 1, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 4, + // p : 14 15 16 | 17 18 19 | 20 21 22 | 23 24 25 26 + 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 8, + // p : 27 28 29 | 30 31 32 | 33 34 35 36 | 37 38 + 9, 9, 9, 10, 10, 10, 11, 11, 11, 11, 12, 12, + // p : 39 40 41 42 | 43 44 45 46 | 47 48 49 + 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, + // p : 50 51 52 53 | 54 55 56 | 57 58 59 + 16, 16, 16, 16, 17, 17, 17, 18, 18, 18, + // p : 60 61 62 63 + 19, 19, 19, 19}; // two-digit -> ASCII lookup (saves divide/modulo per digit) // two_digit_lut[v*2] -> tens digit character