mirror of
https://github.com/RPCS3/rpcs3.git
synced 2026-04-06 06:55:02 +00:00
utils: Implement enum size computation
This commit is contained in:
parent
7240cbfdab
commit
dbb6c87a10
2 changed files with 29 additions and 0 deletions
|
|
@ -362,6 +362,27 @@ std::vector<std::string> cfg::try_to_enum_list(decltype(&fmt_class_string<int>::
|
|||
return result;
|
||||
}
|
||||
|
||||
size_t cfg::try_to_enum_size(decltype(&fmt_class_string<int>::format) func)
|
||||
{
|
||||
size_t result = 0;
|
||||
for (u64 i = 0;; i++)
|
||||
{
|
||||
std::string var;
|
||||
func(var, i);
|
||||
|
||||
std::string hex;
|
||||
fmt_class_string<u64>::format(hex, i);
|
||||
if (var == hex)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
result++;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void cfg::encode(YAML::Emitter& out, const cfg::_base& rhs)
|
||||
{
|
||||
switch (rhs.get_type())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue