Config: Implement 128-bit setting entry type
Some checks are pending
Build RPCS3 / RPCS3 Linux ${{ matrix.os }} ${{ matrix.compiler }} (/rpcs3/.ci/build-linux-aarch64.sh, gcc, rpcs3/rpcs3-ci-jammy-aarch64:1.6, ubuntu-24.04-arm) (push) Waiting to run
Build RPCS3 / RPCS3 Linux ${{ matrix.os }} ${{ matrix.compiler }} (/rpcs3/.ci/build-linux.sh, gcc, rpcs3/rpcs3-ci-jammy:1.6, ubuntu-24.04) (push) Waiting to run
Build RPCS3 / RPCS3 Linux ${{ matrix.os }} ${{ matrix.compiler }} (a1d35836e8d45bfc6f63c26f0a3e5d46ef622fe1, rpcs3/rpcs3-binaries-linux-arm64, /rpcs3/.ci/build-linux-aarch64.sh, clang, rpcs3/rpcs3-ci-jammy-aarch64:1.6, ubuntu-24.04-arm) (push) Waiting to run
Build RPCS3 / RPCS3 Linux ${{ matrix.os }} ${{ matrix.compiler }} (d812f1254a1157c80fd402f94446310560f54e5f, rpcs3/rpcs3-binaries-linux, /rpcs3/.ci/build-linux.sh, clang, rpcs3/rpcs3-ci-jammy:1.6, ubuntu-24.04) (push) Waiting to run
Build RPCS3 / RPCS3 Mac ${{ matrix.name }} (51ae32f468089a8169aaf1567de355ff4a3e0842, rpcs3/rpcs3-binaries-mac, .ci/build-mac.sh, Intel) (push) Waiting to run
Build RPCS3 / RPCS3 Mac ${{ matrix.name }} (8e21bdbc40711a3fccd18fbf17b742348b0f4281, rpcs3/rpcs3-binaries-mac-arm64, .ci/build-mac-arm64.sh, Apple Silicon) (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
Build RPCS3 / RPCS3 Windows Clang (win64, clang, clang64) (push) Waiting to run
Build RPCS3 / RPCS3 FreeBSD (push) Waiting to run

This commit is contained in:
Elad 2025-10-03 16:01:52 +03:00
parent 4141f76105
commit e8aa1caa4e
3 changed files with 146 additions and 0 deletions

View file

@ -38,6 +38,7 @@ namespace cfg
_enum, // cfg::_enum type
_int, // cfg::_int type
uint, // cfg::uint type
uint128, // cfg::uint128 type
string, // cfg::string type
set, // cfg::set_entry type
map, // cfg::map_entry type
@ -578,6 +579,86 @@ namespace cfg
// Alias for 64 bit int
using uint64 = uint<0, u64{umax}>;
// Unsigned 128-bit integer entry.
class uint128 final : public _base
{
using int_type = u128;
atomic_t<int_type> m_value{};
int_type original_def = 0;
public:
int_type def;
uint128(node* owner, const std::string& name, int_type def = 0, bool dynamic = false)
: _base(type::uint128, owner, name, dynamic)
, m_value(def)
, original_def(def)
, def(def)
{
}
operator int_type() const
{
return m_value;
}
operator ullong() const
{
return static_cast<ullong>(m_value.load());
}
int_type get() const
{
return m_value;
}
void from_default() override
{
m_value = def;
}
void restore_defaults() override
{
def = original_def;
}
static std::string to_string(u128 value) noexcept;
std::string to_string() const override
{
return to_string(m_value.load());
}
std::string def_to_string() const override
{
return to_string(def);
}
bool from_string(std::string_view value, bool /*dynamic*/ = false) override
{
u128 result;
if (try_to_uint128(&result, value))
{
m_value = result;
return true;
}
return false;
}
void set(u128 value)
{
m_value = value;
}
std::vector<std::string> to_list() const override
{
// Should not be used
return make_uint_range(0, 1);
}
};
// Simple string entry with mutex
class string : public _base
{