Browse Source

feat: dump 8-bits index of basic ranges

master
Dnomd343 2 years ago
parent
commit
2739f12f89
  1. 39
      all_cases/mark.h
  2. 52
      all_cases/short_code.cc

39
all_cases/mark.h

@ -1,8 +1,43 @@
#pragma once
#include <stdint.h>
#include <cstdint>
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,

52
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<uint64_t> 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;

Loading…
Cancel
Save