mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-04-26 11:39:01 +02:00
[common] fix formatting of swapped u32_le/u64_le for BE targets (#2998)
Fixes a bunch of errors :) Signed-off-by: lizzie <lizzie@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/2998 Reviewed-by: Caio Oliveira <caiooliveirafarias0@gmail.com> Reviewed-by: MaranBr <maranbr@eden-emu.dev> Co-authored-by: lizzie <lizzie@eden-emu.dev> Co-committed-by: lizzie <lizzie@eden-emu.dev>
This commit is contained in:
parent
9a046190c7
commit
66db2613b5
2 changed files with 155 additions and 140 deletions
|
|
@ -1,11 +1,14 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
#include <fmt/ranges.h>
|
||||
#include "common/swap.h"
|
||||
|
||||
// adapted from https://github.com/fmtlib/fmt/issues/2704
|
||||
// a generic formatter for enum classes
|
||||
|
|
@ -20,3 +23,14 @@ struct fmt::formatter<T, std::enable_if_t<std::is_enum_v<T>, char>>
|
|||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
template <typename T, typename U>
|
||||
struct fmt::formatter<SwapStructT<T, U>> {
|
||||
constexpr auto parse(format_parse_context& ctx) {
|
||||
return ctx.begin();
|
||||
}
|
||||
template <typename FormatContext>
|
||||
auto format(const SwapStructT<T, U>& reg, FormatContext& ctx) const {
|
||||
return fmt::format_to(ctx.out(), "{}", T(reg));
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue