2
1
Fork 0
mirror of https://github.com/yuzu-emu/yuzu.git synced 2024-07-04 23:31:19 +01:00

remove all occurance of specifying endianness inside BitField

This commit it automatically generated by command in zsh:
sed -i -- 's/BitField<\(.*\)_le>/BitField<\1>/g' **/*(D.)

BitField is now aware to endianness and default to little endian. It expects a value representation type without storage specification for its template parameter.
This commit is contained in:
Weiyi Wang 2019-01-25 12:26:47 -05:00 committed by fearlessTobi
parent 6b81ceb060
commit 89abef3518
6 changed files with 96 additions and 96 deletions

View file

@ -39,10 +39,10 @@ struct CommandHeader {
union { union {
u32_le raw_low; u32_le raw_low;
BitField<0, 16, CommandType> type; BitField<0, 16, CommandType> type;
BitField<16, 4, u32_le> num_buf_x_descriptors; BitField<16, 4, u32> num_buf_x_descriptors;
BitField<20, 4, u32_le> num_buf_a_descriptors; BitField<20, 4, u32> num_buf_a_descriptors;
BitField<24, 4, u32_le> num_buf_b_descriptors; BitField<24, 4, u32> num_buf_b_descriptors;
BitField<28, 4, u32_le> num_buf_w_descriptors; BitField<28, 4, u32> num_buf_w_descriptors;
}; };
enum class BufferDescriptorCFlag : u32 { enum class BufferDescriptorCFlag : u32 {
@ -53,28 +53,28 @@ struct CommandHeader {
union { union {
u32_le raw_high; u32_le raw_high;
BitField<0, 10, u32_le> data_size; BitField<0, 10, u32> data_size;
BitField<10, 4, BufferDescriptorCFlag> buf_c_descriptor_flags; BitField<10, 4, BufferDescriptorCFlag> buf_c_descriptor_flags;
BitField<31, 1, u32_le> enable_handle_descriptor; BitField<31, 1, u32> enable_handle_descriptor;
}; };
}; };
static_assert(sizeof(CommandHeader) == 8, "CommandHeader size is incorrect"); static_assert(sizeof(CommandHeader) == 8, "CommandHeader size is incorrect");
union HandleDescriptorHeader { union HandleDescriptorHeader {
u32_le raw_high; u32_le raw_high;
BitField<0, 1, u32_le> send_current_pid; BitField<0, 1, u32> send_current_pid;
BitField<1, 4, u32_le> num_handles_to_copy; BitField<1, 4, u32> num_handles_to_copy;
BitField<5, 4, u32_le> num_handles_to_move; BitField<5, 4, u32> num_handles_to_move;
}; };
static_assert(sizeof(HandleDescriptorHeader) == 4, "HandleDescriptorHeader size is incorrect"); static_assert(sizeof(HandleDescriptorHeader) == 4, "HandleDescriptorHeader size is incorrect");
struct BufferDescriptorX { struct BufferDescriptorX {
union { union {
BitField<0, 6, u32_le> counter_bits_0_5; BitField<0, 6, u32> counter_bits_0_5;
BitField<6, 3, u32_le> address_bits_36_38; BitField<6, 3, u32> address_bits_36_38;
BitField<9, 3, u32_le> counter_bits_9_11; BitField<9, 3, u32> counter_bits_9_11;
BitField<12, 4, u32_le> address_bits_32_35; BitField<12, 4, u32> address_bits_32_35;
BitField<16, 16, u32_le> size; BitField<16, 16, u32> size;
}; };
u32_le address_bits_0_31; u32_le address_bits_0_31;
@ -103,10 +103,10 @@ struct BufferDescriptorABW {
u32_le address_bits_0_31; u32_le address_bits_0_31;
union { union {
BitField<0, 2, u32_le> flags; BitField<0, 2, u32> flags;
BitField<2, 3, u32_le> address_bits_36_38; BitField<2, 3, u32> address_bits_36_38;
BitField<24, 4, u32_le> size_bits_32_35; BitField<24, 4, u32> size_bits_32_35;
BitField<28, 4, u32_le> address_bits_32_35; BitField<28, 4, u32> address_bits_32_35;
}; };
VAddr Address() const { VAddr Address() const {
@ -128,8 +128,8 @@ struct BufferDescriptorC {
u32_le address_bits_0_31; u32_le address_bits_0_31;
union { union {
BitField<0, 16, u32_le> address_bits_32_47; BitField<0, 16, u32> address_bits_32_47;
BitField<16, 16, u32_le> size; BitField<16, 16, u32> size;
}; };
VAddr Address() const { VAddr Address() const {
@ -167,8 +167,8 @@ struct DomainMessageHeader {
struct { struct {
union { union {
BitField<0, 8, CommandType> command; BitField<0, 8, CommandType> command;
BitField<8, 8, u32_le> input_object_count; BitField<8, 8, u32> input_object_count;
BitField<16, 16, u32_le> size; BitField<16, 16, u32> size;
}; };
u32_le object_id; u32_le object_id;
INSERT_PADDING_WORDS(2); INSERT_PADDING_WORDS(2);

View file

@ -41,20 +41,20 @@ private:
struct PadState { struct PadState {
union { union {
u32_le raw{}; u32_le raw{};
BitField<0, 1, u32_le> a; BitField<0, 1, u32> a;
BitField<1, 1, u32_le> b; BitField<1, 1, u32> b;
BitField<2, 1, u32_le> x; BitField<2, 1, u32> x;
BitField<3, 1, u32_le> y; BitField<3, 1, u32> y;
BitField<4, 1, u32_le> l; BitField<4, 1, u32> l;
BitField<5, 1, u32_le> r; BitField<5, 1, u32> r;
BitField<6, 1, u32_le> zl; BitField<6, 1, u32> zl;
BitField<7, 1, u32_le> zr; BitField<7, 1, u32> zr;
BitField<8, 1, u32_le> plus; BitField<8, 1, u32> plus;
BitField<9, 1, u32_le> minus; BitField<9, 1, u32> minus;
BitField<10, 1, u32_le> d_left; BitField<10, 1, u32> d_left;
BitField<11, 1, u32_le> d_up; BitField<11, 1, u32> d_up;
BitField<12, 1, u32_le> d_right; BitField<12, 1, u32> d_right;
BitField<13, 1, u32_le> d_down; BitField<13, 1, u32> d_down;
}; };
}; };
static_assert(sizeof(PadState) == 0x4, "PadState is an invalid size"); static_assert(sizeof(PadState) == 0x4, "PadState is an invalid size");
@ -62,7 +62,7 @@ private:
struct Attributes { struct Attributes {
union { union {
u32_le raw{}; u32_le raw{};
BitField<0, 1, u32_le> connected; BitField<0, 1, u32> connected;
}; };
}; };
static_assert(sizeof(Attributes) == 0x4, "Attributes is an invalid size"); static_assert(sizeof(Attributes) == 0x4, "Attributes is an invalid size");

View file

@ -39,13 +39,13 @@ public:
union { union {
u32_le raw{}; u32_le raw{};
BitField<0, 1, u32_le> pro_controller; BitField<0, 1, u32> pro_controller;
BitField<1, 1, u32_le> handheld; BitField<1, 1, u32> handheld;
BitField<2, 1, u32_le> joycon_dual; BitField<2, 1, u32> joycon_dual;
BitField<3, 1, u32_le> joycon_left; BitField<3, 1, u32> joycon_left;
BitField<4, 1, u32_le> joycon_right; BitField<4, 1, u32> joycon_right;
BitField<6, 1, u32_le> pokeball; // TODO(ogniK): Confirm when possible BitField<6, 1, u32> pokeball; // TODO(ogniK): Confirm when possible
}; };
}; };
static_assert(sizeof(NPadType) == 4, "NPadType is an invalid size"); static_assert(sizeof(NPadType) == 4, "NPadType is an invalid size");
@ -150,43 +150,43 @@ private:
union { union {
u64_le raw{}; u64_le raw{};
// Button states // Button states
BitField<0, 1, u64_le> a; BitField<0, 1, u64> a;
BitField<1, 1, u64_le> b; BitField<1, 1, u64> b;
BitField<2, 1, u64_le> x; BitField<2, 1, u64> x;
BitField<3, 1, u64_le> y; BitField<3, 1, u64> y;
BitField<4, 1, u64_le> l_stick; BitField<4, 1, u64> l_stick;
BitField<5, 1, u64_le> r_stick; BitField<5, 1, u64> r_stick;
BitField<6, 1, u64_le> l; BitField<6, 1, u64> l;
BitField<7, 1, u64_le> r; BitField<7, 1, u64> r;
BitField<8, 1, u64_le> zl; BitField<8, 1, u64> zl;
BitField<9, 1, u64_le> zr; BitField<9, 1, u64> zr;
BitField<10, 1, u64_le> plus; BitField<10, 1, u64> plus;
BitField<11, 1, u64_le> minus; BitField<11, 1, u64> minus;
// D-Pad // D-Pad
BitField<12, 1, u64_le> d_left; BitField<12, 1, u64> d_left;
BitField<13, 1, u64_le> d_up; BitField<13, 1, u64> d_up;
BitField<14, 1, u64_le> d_right; BitField<14, 1, u64> d_right;
BitField<15, 1, u64_le> d_down; BitField<15, 1, u64> d_down;
// Left JoyStick // Left JoyStick
BitField<16, 1, u64_le> l_stick_left; BitField<16, 1, u64> l_stick_left;
BitField<17, 1, u64_le> l_stick_up; BitField<17, 1, u64> l_stick_up;
BitField<18, 1, u64_le> l_stick_right; BitField<18, 1, u64> l_stick_right;
BitField<19, 1, u64_le> l_stick_down; BitField<19, 1, u64> l_stick_down;
// Right JoyStick // Right JoyStick
BitField<20, 1, u64_le> r_stick_left; BitField<20, 1, u64> r_stick_left;
BitField<21, 1, u64_le> r_stick_up; BitField<21, 1, u64> r_stick_up;
BitField<22, 1, u64_le> r_stick_right; BitField<22, 1, u64> r_stick_right;
BitField<23, 1, u64_le> r_stick_down; BitField<23, 1, u64> r_stick_down;
// Not always active? // Not always active?
BitField<24, 1, u64_le> left_sl; BitField<24, 1, u64> left_sl;
BitField<25, 1, u64_le> left_sr; BitField<25, 1, u64> left_sr;
BitField<26, 1, u64_le> right_sl; BitField<26, 1, u64> right_sl;
BitField<27, 1, u64_le> right_sr; BitField<27, 1, u64> right_sr;
}; };
}; };
static_assert(sizeof(ControllerPadState) == 8, "ControllerPadState is an invalid size"); static_assert(sizeof(ControllerPadState) == 8, "ControllerPadState is an invalid size");
@ -200,12 +200,12 @@ private:
struct ConnectionState { struct ConnectionState {
union { union {
u32_le raw{}; u32_le raw{};
BitField<0, 1, u32_le> IsConnected; BitField<0, 1, u32> IsConnected;
BitField<1, 1, u32_le> IsWired; BitField<1, 1, u32> IsWired;
BitField<2, 1, u32_le> IsLeftJoyConnected; BitField<2, 1, u32> IsLeftJoyConnected;
BitField<3, 1, u32_le> IsLeftJoyWired; BitField<3, 1, u32> IsLeftJoyWired;
BitField<4, 1, u32_le> IsRightJoyConnected; BitField<4, 1, u32> IsRightJoyConnected;
BitField<5, 1, u32_le> IsRightJoyWired; BitField<5, 1, u32> IsRightJoyWired;
}; };
}; };
static_assert(sizeof(ConnectionState) == 4, "ConnectionState is an invalid size"); static_assert(sizeof(ConnectionState) == 4, "ConnectionState is an invalid size");
@ -240,23 +240,23 @@ private:
struct NPadProperties { struct NPadProperties {
union { union {
s64_le raw{}; s64_le raw{};
BitField<11, 1, s64_le> is_vertical; BitField<11, 1, s64> is_vertical;
BitField<12, 1, s64_le> is_horizontal; BitField<12, 1, s64> is_horizontal;
BitField<13, 1, s64_le> use_plus; BitField<13, 1, s64> use_plus;
BitField<14, 1, s64_le> use_minus; BitField<14, 1, s64> use_minus;
}; };
}; };
struct NPadDevice { struct NPadDevice {
union { union {
u32_le raw{}; u32_le raw{};
BitField<0, 1, s32_le> pro_controller; BitField<0, 1, s32> pro_controller;
BitField<1, 1, s32_le> handheld; BitField<1, 1, s32> handheld;
BitField<2, 1, s32_le> handheld_left; BitField<2, 1, s32> handheld_left;
BitField<3, 1, s32_le> handheld_right; BitField<3, 1, s32> handheld_right;
BitField<4, 1, s32_le> joycon_left; BitField<4, 1, s32> joycon_left;
BitField<5, 1, s32_le> joycon_right; BitField<5, 1, s32> joycon_right;
BitField<6, 1, s32_le> pokeball; BitField<6, 1, s32> pokeball;
}; };
}; };

View file

@ -33,8 +33,8 @@ private:
struct Attributes { struct Attributes {
union { union {
u32 raw{}; u32 raw{};
BitField<0, 1, u32_le> start_touch; BitField<0, 1, u32> start_touch;
BitField<1, 1, u32_le> end_touch; BitField<1, 1, u32> end_touch;
}; };
}; };
static_assert(sizeof(Attributes) == 0x4, "Attributes is an invalid size"); static_assert(sizeof(Attributes) == 0x4, "Attributes is an invalid size");

View file

@ -42,7 +42,7 @@ private:
union { union {
BitField<0, 16, Flags> flags; BitField<0, 16, Flags> flags;
BitField<16, 8, Severity> severity; BitField<16, 8, Severity> severity;
BitField<24, 8, u32_le> verbosity; BitField<24, 8, u32> verbosity;
}; };
u32_le payload_size; u32_le payload_size;

View file

@ -19,11 +19,11 @@ public:
virtual ~nvdevice() = default; virtual ~nvdevice() = default;
union Ioctl { union Ioctl {
u32_le raw; u32_le raw;
BitField<0, 8, u32_le> cmd; BitField<0, 8, u32> cmd;
BitField<8, 8, u32_le> group; BitField<8, 8, u32> group;
BitField<16, 14, u32_le> length; BitField<16, 14, u32> length;
BitField<30, 1, u32_le> is_in; BitField<30, 1, u32> is_in;
BitField<31, 1, u32_le> is_out; BitField<31, 1, u32> is_out;
}; };
/** /**