Browse Source

update: basic ranges offset list

legacy
Dnomd343 2 years ago
parent
commit
66640dcbd6
  1. 35
      all_cases/mark.h
  2. 50
      all_cases/short_code.cc

35
all_cases/mark.h

@ -37,6 +37,41 @@ const uint32_t BASIC_RANGES_INDEX[256] = {
48555, 15163, 15163, 43244, 133653, 43244, 43244, 122125,
};
const uint32_t BASIC_RANGES_OFFSET[256] = {
0, 136384, 186304, 236224, 372608, 422528, 440800, 459072,
508992, 558912, 577184, 595456, 645376, 781760, 831680, 881600,
1017984, 1067904, 1086176, 1104448, 1154368, 1172640, 1178987, 1185334,
1202923, 1221195, 1227542, 1233889, 1251478, 1301398, 1318987, 1336576,
1385131, 1435051, 1453323, 1471595, 1521515, 1539787, 1546134, 1552481,
1570070, 1588342, 1594689, 1601036, 1618625, 1668545, 1686134, 1703723,
1752278, 1888662, 1938582, 1988502, 2124886, 2174806, 2192395, 2209984,
2258539, 2308459, 2326048, 2343637, 2392192, 2528576, 2577131, 2625686,
2759339, 2809259, 2827531, 2845803, 2895723, 2913995, 2920342, 2926689,
2944278, 2962550, 2968897, 2975244, 2992833, 3042753, 3060342, 3077931,
3126486, 3144758, 3151105, 3157452, 3175041, 3181388, 3183173, 3184958,
3190204, 3196551, 3198336, 3200121, 3205367, 3222956, 3228202, 3233448,
3248611, 3266883, 3273230, 3279577, 3297166, 3303513, 3305298, 3307083,
3312329, 3318676, 3320461, 3322246, 3327492, 3345081, 3350327, 3355573,
3370736, 3420656, 3438245, 3455834, 3504389, 3521978, 3527224, 3532470,
3547633, 3565222, 3570468, 3575714, 3590877, 3639432, 3654595, 3669758,
3713002, 3762922, 3781194, 3799466, 3849386, 3867658, 3874005, 3880352,
3897941, 3916213, 3922560, 3928907, 3946496, 3996416, 4014005, 4031594,
4080149, 4098421, 4104768, 4111115, 4128704, 4135051, 4136836, 4138621,
4143867, 4150214, 4151999, 4153784, 4159030, 4176619, 4181865, 4187111,
4202274, 4220546, 4226893, 4233240, 4250829, 4257176, 4258961, 4260746,
4265992, 4272339, 4274124, 4275909, 4281155, 4298744, 4303990, 4309236,
4324399, 4374319, 4391908, 4409497, 4458052, 4475641, 4480887, 4486133,
4501296, 4518885, 4524131, 4529377, 4544540, 4593095, 4608258, 4623421,
4666665, 4803049, 4852969, 4902889, 5039273, 5089193, 5106782, 5124371,
5172926, 5222846, 5240435, 5258024, 5306579, 5442963, 5491518, 5540073,
5673726, 5723646, 5741235, 5758824, 5807379, 5824968, 5830214, 5835460,
5850623, 5868212, 5873458, 5878704, 5893867, 5942422, 5957585, 5972748,
6015992, 6065912, 6083501, 6101090, 6149645, 6167234, 6172480, 6177726,
6192889, 6210478, 6215724, 6220970, 6236133, 6284688, 6299851, 6315014,
6358258, 6494642, 6543197, 6591752, 6725405, 6773960, 6789123, 6804286,
6847530, 6896085, 6911248, 6926411, 6969655, 7103308, 7146552, 7189796,
};
const uint32_t SHORT_CODE_MARK[16][256] = {
{
70039, 0, 25594, 70039, 25594, 9527, 9324, 25594, 22458, 0, 9527, 22458, 70039, 0, 25594, 70039,

50
all_cases/short_code.cc

@ -73,6 +73,24 @@ int main() {
// all_cases_dict[all_cases[i]] = i;
// }
uint32_t sum = 0;
uint32_t index[256];
for (int i = 0; i < 256; ++i) {
index[i] = sum;
sum += BASIC_RANGES_INDEX[i];
}
// for (int i = 0; i < 256; ++i) {
// if (i % 8 == 0) {
// printf(" ");
// }
// printf("%7d, ", index[i]);
// if (i % 8 == 7) {
// printf("\n");
// }
// }
// return 0;
uint32_t short_code = 14323231;
// printf("%09lX\n", all_cases[0]);
// printf("%09lX\n", all_cases[short_code]);
@ -107,24 +125,6 @@ int main() {
// }
// }
// group size => 256 => 8-bits
// min range -> xx * 7 -> 14-bits
// 00 00 00 00 ... => ... 00 00 00 00
// 00 00 00 01 ... => ... 01 00 00 00
// 00 00 00 10 ... => ... 10 00 00 00
// 00 00 00 11 ... => ... 11 00 00 00
// ...
// ...00000000 -> 0
// ...01000000 -> ...
// ...10000000 -> ...
// ...11000000 -> ...
// record start search point
int prefix = 0;
for (; prefix < 256; ++prefix) {
if (short_code < SHORT_CODE_MARK[head][prefix]) {
@ -135,15 +135,17 @@ int main() {
std::cout << "prefix: " << prefix << std::endl;
std::cout << "sub sub short code: " << short_code << std::endl;
uint32_t basic_ranges_start = 0;
for (int i = 0; i < prefix; ++i) {
basic_ranges_start += BASIC_RANGES_INDEX[i];
}
std::cout << "basic ranges start: " << basic_ranges_start << std::endl;
// uint32_t basic_ranges_start = 0;
// for (int i = 0; i < prefix; ++i) {
// basic_ranges_start += BASIC_RANGES_INDEX[i];
// }
// std::cout << "basic ranges start: " << basic_ranges_start << std::endl;
std::cout << "basic range offset: " << BASIC_RANGES_OFFSET[prefix] << std::endl;
uint32_t range;
for (int i = 0; i < BASIC_RANGES_INDEX[prefix]; ++i) {
range = a.basic_ranges[i + basic_ranges_start];
// range = a.basic_ranges[i + basic_ranges_start];
range = a.basic_ranges[i + BASIC_RANGES_OFFSET[prefix]];
if (AllCases::check_case(head, range)) {
if (short_code == 0) {
break;

Loading…
Cancel
Save