mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-11-15 22:40:33 +01:00
[common] rework BitField and BitUtil, use concepts whenever possible (#4076)
test no regressions especially on Liiinux Signed-off-by: lizzie <lizzie@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4076 Reviewed-by: CamilleLaVey <camillelavey99@gmail.com> Reviewed-by: MaranBr <maranbr@eden-emu.dev>
This commit is contained in:
parent
c2e74a9380
commit
41762940d6
31 changed files with 529 additions and 757 deletions
|
|
@ -284,9 +284,9 @@ u8 RingController::GetCrcValue(const std::vector<u8>& data) const {
|
|||
}
|
||||
|
||||
template <typename T>
|
||||
requires std::is_trivially_copyable_v<T>
|
||||
u64 RingController::GetData(const T& reply, std::span<u8> out_data) const {
|
||||
static_assert(std::is_trivially_copyable_v<T>);
|
||||
const auto data_size = static_cast<u64>((std::min)(sizeof(reply), out_data.size()));
|
||||
const auto data_size = u64((std::min)(sizeof(reply), out_data.size()));
|
||||
std::memcpy(out_data.data(), &reply, data_size);
|
||||
return data_size;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,6 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
// SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
|
|
@ -221,6 +224,7 @@ private:
|
|||
|
||||
// Converts structs to an u8 vector equivalent
|
||||
template <typename T>
|
||||
requires std::is_trivially_copyable_v<T>
|
||||
u64 GetData(const T& reply, std::span<u8> out_data) const;
|
||||
|
||||
RingConCommands command{RingConCommands::Error};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue