RhythmGame 1.4.3
Loading...
Searching...
No Matches
Base62.h
Go to the documentation of this file.
1//
2// Created by PC on 11/03/2026.
3//
4
5#ifndef RHYTHMGAME_BASE62_H
6#define RHYTHMGAME_BASE62_H
7#include <algorithm>
8#include <concepts>
9
10namespace charts {
11template<std::integral T>
12constexpr auto
14{
15 auto result = 0;
16 auto multiplier = 1;
17 while (value > 0) {
18 auto digit = value % 62;
19 value /= 62;
20 if (digit < 36) {
21 result += digit * multiplier;
22 } else {
23 result += (digit - 26) * multiplier;
24 }
25 multiplier *= 36;
26 }
27 return result;
28}
29template<std::integral T>
30constexpr auto
32{
33 auto result = 0;
34 auto multiplier = 1;
35 while (value > 0) {
36 auto digit = value % 62;
37 value /= 62;
38 if (digit < 36) {
39 result += std::min(digit, 15) * multiplier;
40 } else {
41 result += std::min((digit - 26), 15) * multiplier;
42 }
43 multiplier *= 16;
44 }
45 return result;
46}
47} // namespace charts
48
49#endif // RHYTHMGAME_BASE62_H
double value
Definition BmsNotesData.cpp:35
gameplay_logic::BmsResult::DTO result
Definition ScoreDb.cpp:86
Classes and functions related to loading and calculating offsets in BMS charts.
Definition Base62.cpp:7
constexpr auto base62ToBase36(T value) -> T
Definition Base62.h:13
constexpr auto base62ToBase16(T value)
Definition Base62.h:31