From 2739f12f893ae6a9603ece38d9c836ca11158e60 Mon Sep 17 00:00:00 2001 From: Dnomd343 Date: Thu, 5 Jan 2023 17:43:44 +0800 Subject: [PATCH] feat: dump 8-bits index of basic ranges --- all_cases/mark.h | 39 +++++++++++++++++++++++++++++-- all_cases/short_code.cc | 52 +++++++++++++++++++++++++++-------------- 2 files changed, 71 insertions(+), 20 deletions(-) diff --git a/all_cases/mark.h b/all_cases/mark.h index 30e1cfd..508bb8c 100644 --- a/all_cases/mark.h +++ b/all_cases/mark.h @@ -1,8 +1,43 @@ #pragma once -#include +#include -const uint32_t SHORT_CODE_MARK[16][0x100] = { +const uint32_t BASIC_RANGES_INDEX[256] = { + 136384, 49920, 49920, 136384, 49920, 18272, 18272, 49920, + 49920, 18272, 18272, 49920, 136384, 49920, 49920, 136384, + 49920, 18272, 18272, 49920, 18272, 6347, 6347, 17589, + 18272, 6347, 6347, 17589, 49920, 17589, 17589, 48555, + 49920, 18272, 18272, 49920, 18272, 6347, 6347, 17589, + 18272, 6347, 6347, 17589, 49920, 17589, 17589, 48555, + 136384, 49920, 49920, 136384, 49920, 17589, 17589, 48555, + 49920, 17589, 17589, 48555, 136384, 48555, 48555, 133653, + 49920, 18272, 18272, 49920, 18272, 6347, 6347, 17589, + 18272, 6347, 6347, 17589, 49920, 17589, 17589, 48555, + 18272, 6347, 6347, 17589, 6347, 1785, 1785, 5246, + 6347, 1785, 1785, 5246, 17589, 5246, 5246, 15163, + 18272, 6347, 6347, 17589, 6347, 1785, 1785, 5246, + 6347, 1785, 1785, 5246, 17589, 5246, 5246, 15163, + 49920, 17589, 17589, 48555, 17589, 5246, 5246, 15163, + 17589, 5246, 5246, 15163, 48555, 15163, 15163, 43244, + 49920, 18272, 18272, 49920, 18272, 6347, 6347, 17589, + 18272, 6347, 6347, 17589, 49920, 17589, 17589, 48555, + 18272, 6347, 6347, 17589, 6347, 1785, 1785, 5246, + 6347, 1785, 1785, 5246, 17589, 5246, 5246, 15163, + 18272, 6347, 6347, 17589, 6347, 1785, 1785, 5246, + 6347, 1785, 1785, 5246, 17589, 5246, 5246, 15163, + 49920, 17589, 17589, 48555, 17589, 5246, 5246, 15163, + 17589, 5246, 5246, 15163, 48555, 15163, 15163, 43244, + 136384, 49920, 49920, 136384, 49920, 17589, 17589, 48555, + 49920, 17589, 17589, 48555, 136384, 48555, 48555, 133653, + 49920, 17589, 17589, 48555, 17589, 5246, 5246, 15163, + 17589, 5246, 5246, 15163, 48555, 15163, 15163, 43244, + 49920, 17589, 17589, 48555, 17589, 5246, 5246, 15163, + 17589, 5246, 5246, 15163, 48555, 15163, 15163, 43244, + 136384, 48555, 48555, 133653, 48555, 15163, 15163, 43244, + 48555, 15163, 15163, 43244, 133653, 43244, 43244, 122125, +}; + +const uint32_t SHORT_CODE_MARK[16][256] = { { 70039, 0, 25594, 70039, 25594, 9527, 9324, 25594, 22458, 0, 9527, 22458, 70039, 0, 25594, 70039, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, diff --git a/all_cases/short_code.cc b/all_cases/short_code.cc index 4b3b547..86fcbba 100644 --- a/all_cases/short_code.cc +++ b/all_cases/short_code.cc @@ -58,7 +58,7 @@ uint32_t code_from_string(const std::string &short_code) { int main() { auto a = AllCases(); - a.find_all_cases(); +// a.find_all_cases(); // std::vector all_cases; // for (int n = 0; n < 16; ++n) { @@ -129,27 +129,43 @@ int main() { // printf("%08X\n", a.all_cases[6][1]); // printf("%08X\n", a.all_cases[6][2]); - uint32_t index[256]; - for (auto &all_case : a.all_cases) { - printf(" {\n"); - for (uint32_t &tmp: index) { - tmp = 0; - } - for (auto &range: all_case) { - ++index[range >> 24]; +// uint32_t index[256]; +// for (auto &all_case : a.all_cases) { +// printf(" {\n"); +// for (uint32_t &tmp: index) { +// tmp = 0; +// } +// for (auto &range: all_case) { +// ++index[range >> 24]; +// } +// for (int i = 0; i < 256; ++i) { +// if (i % 16 == 0) { +// printf(" "); +// } +// printf("%5d, ", index[i]); +// if (i % 16 == 15) { +// printf("\n"); +// } +// } +// printf(" },\n"); +// } + + uint32_t index[256] = {0}; + for (auto range : a.basic_ranges) { + range = AllCases::binary_reverse(range); + ++index[range >> 24]; + } + for (int i = 0; i < 256; ++i) { + if (i % 8 == 0) { + printf(" "); } - for (int i = 0; i < 256; ++i) { - if (i % 16 == 0) { - printf(" "); - } - printf("%5d, ", index[i]); - if (i % 16 == 15) { - printf("\n"); - } + printf("%6d, ", index[i]); + if (i % 8 == 7) { + printf("\n"); } - printf(" },\n"); } + // std::cout << code_to_string(14323231) << std::endl; // std::cout << code_from_string("8IzVj") << std::endl;