mirror of
https://github.com/Lime3DS/Lime3DS.git
synced 2024-11-30 13:24:16 +01:00
Merge pull request #5315 from lioncash/undef
soc_u: Prevent undefined behavior with CTRPollFD
This commit is contained in:
commit
eb996f046d
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
#include <type_traits>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "common/archives.h"
|
#include "common/archives.h"
|
||||||
#include "common/assert.h"
|
#include "common/assert.h"
|
||||||
@ -199,11 +200,6 @@ struct CTRPollFD {
|
|||||||
BitField<4, 1, u32> pollout;
|
BitField<4, 1, u32> pollout;
|
||||||
BitField<5, 1, u32> pollnval;
|
BitField<5, 1, u32> pollnval;
|
||||||
|
|
||||||
Events& operator=(const Events& other) {
|
|
||||||
hex = other.hex;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Translates the resulting events of a Poll operation from platform-specific to 3ds
|
/// Translates the resulting events of a Poll operation from platform-specific to 3ds
|
||||||
/// specific
|
/// specific
|
||||||
static Events TranslateTo3DS(u32 input_event) {
|
static Events TranslateTo3DS(u32 input_event) {
|
||||||
@ -263,6 +259,8 @@ struct CTRPollFD {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
static_assert(std::is_trivially_copyable_v<CTRPollFD>,
|
||||||
|
"CTRPollFD is used with std::memcpy and must be trivially copyable");
|
||||||
|
|
||||||
/// Union to represent the 3ds' sockaddr structure
|
/// Union to represent the 3ds' sockaddr structure
|
||||||
union CTRSockAddr {
|
union CTRSockAddr {
|
||||||
|
Loading…
Reference in New Issue
Block a user