|
@ -11,20 +11,28 @@ const char SHORT_CODE_TABLE[32] = { |
|
|
'N', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', |
|
|
'N', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
// 1 -> 48
|
|
|
const char SHORT_CODE_TABLE_REV[26] = { |
|
|
// ...
|
|
|
// 00 01 02 03 04 05 06 07 08 09
|
|
|
// 9 -> 57
|
|
|
9, 10, 11, 12, 13, 14, 15, 16, 0, 17, |
|
|
// A -> 65
|
|
|
// 10 11 12 13 14 15 16 17 18 19
|
|
|
|
|
|
18, 0, 19, 20, 0, 21, 22, 23, 24, 25, |
|
|
|
|
|
// 20 21 22 23 24 25
|
|
|
|
|
|
26, 27, 28, 29, 30, 31, |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
// 00: 1 -> 48
|
|
|
// ...
|
|
|
// ...
|
|
|
// H -> 72
|
|
|
// 08: 9 -> 57
|
|
|
// J -> 74
|
|
|
// 09: A -> 65 (00)
|
|
|
// ...
|
|
|
// ...
|
|
|
// K -> 75
|
|
|
// 16: H -> 72 (07)
|
|
|
// M -> 77
|
|
|
// 17: J -> 74 (09)
|
|
|
// N -> 78
|
|
|
// 18: K -> 75 (10)
|
|
|
// P -> 80
|
|
|
// 19: M -> 77 (12)
|
|
|
|
|
|
// 20: N -> 78 (13)
|
|
|
|
|
|
// 21: P -> 80 (15)
|
|
|
// ...
|
|
|
// ...
|
|
|
// Z -> 90
|
|
|
// 31: Z -> 90 (25)
|
|
|
|
|
|
|
|
|
class ShortCode { |
|
|
class ShortCode { |
|
|
public: |
|
|
public: |
|
@ -39,7 +47,7 @@ public: |
|
|
uint64_t unzip_short_code(uint32_t short_code); |
|
|
uint64_t unzip_short_code(uint32_t short_code); |
|
|
|
|
|
|
|
|
static std::string code_to_string(uint32_t short_code); |
|
|
static std::string code_to_string(uint32_t short_code); |
|
|
// static uint32_t code_from_string(const std::string &short_code);
|
|
|
static uint32_t code_from_string(const std::string &short_code); |
|
|
|
|
|
|
|
|
private: |
|
|
private: |
|
|
static const uint32_t SHORT_CODE_LIMIT = 29334498; |
|
|
static const uint32_t SHORT_CODE_LIMIT = 29334498; |
|
|