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
parent 055b9513a3
commit 104829ae58
7 changed files with 99 additions and 99 deletions

View File

@ -126,29 +126,29 @@ struct SourceConfiguration {
union {
u32_le dirty_raw;
BitField<0, 1, u32_le> format_dirty;
BitField<1, 1, u32_le> mono_or_stereo_dirty;
BitField<2, 1, u32_le> adpcm_coefficients_dirty;
BitField<0, 1, u32> format_dirty;
BitField<1, 1, u32> mono_or_stereo_dirty;
BitField<2, 1, u32> adpcm_coefficients_dirty;
/// Tends to be set when a looped buffer is queued.
BitField<3, 1, u32_le> partial_embedded_buffer_dirty;
BitField<4, 1, u32_le> partial_reset_flag;
BitField<3, 1, u32> partial_embedded_buffer_dirty;
BitField<4, 1, u32> partial_reset_flag;
BitField<16, 1, u32_le> enable_dirty;
BitField<17, 1, u32_le> interpolation_dirty;
BitField<18, 1, u32_le> rate_multiplier_dirty;
BitField<19, 1, u32_le> buffer_queue_dirty;
BitField<20, 1, u32_le> loop_related_dirty;
BitField<16, 1, u32> enable_dirty;
BitField<17, 1, u32> interpolation_dirty;
BitField<18, 1, u32> rate_multiplier_dirty;
BitField<19, 1, u32> buffer_queue_dirty;
BitField<20, 1, u32> loop_related_dirty;
/// Tends to also be set when embedded buffer is updated.
BitField<21, 1, u32_le> play_position_dirty;
BitField<22, 1, u32_le> filters_enabled_dirty;
BitField<23, 1, u32_le> simple_filter_dirty;
BitField<24, 1, u32_le> biquad_filter_dirty;
BitField<25, 1, u32_le> gain_0_dirty;
BitField<26, 1, u32_le> gain_1_dirty;
BitField<27, 1, u32_le> gain_2_dirty;
BitField<28, 1, u32_le> sync_dirty;
BitField<29, 1, u32_le> reset_flag;
BitField<30, 1, u32_le> embedded_buffer_dirty;
BitField<21, 1, u32> play_position_dirty;
BitField<22, 1, u32> filters_enabled_dirty;
BitField<23, 1, u32> simple_filter_dirty;
BitField<24, 1, u32> biquad_filter_dirty;
BitField<25, 1, u32> gain_0_dirty;
BitField<26, 1, u32> gain_1_dirty;
BitField<27, 1, u32> gain_2_dirty;
BitField<28, 1, u32> sync_dirty;
BitField<29, 1, u32> reset_flag;
BitField<30, 1, u32> embedded_buffer_dirty;
};
// Gain control
@ -206,8 +206,8 @@ struct SourceConfiguration {
union {
u16_le filters_enabled;
BitField<0, 1, u16_le> simple_filter_enabled;
BitField<1, 1, u16_le> biquad_filter_enabled;
BitField<0, 1, u16> simple_filter_enabled;
BitField<1, 1, u16> biquad_filter_enabled;
};
SimpleFilter simple_filter;
@ -227,8 +227,8 @@ struct SourceConfiguration {
/// ADPCM Predictor (4 bits) and Scale (4 bits)
union {
u16_le adpcm_ps;
BitField<0, 4, u16_le> adpcm_scale;
BitField<4, 4, u16_le> adpcm_predictor;
BitField<0, 4, u16> adpcm_scale;
BitField<4, 4, u16> adpcm_predictor;
};
/// ADPCM Historical Samples (y[n-1] and y[n-2])
@ -285,14 +285,14 @@ struct SourceConfiguration {
u16_le flags1_raw;
BitField<0, 2, MonoOrStereo> mono_or_stereo;
BitField<2, 2, Format> format;
BitField<5, 1, u16_le> fade_in;
BitField<5, 1, u16> fade_in;
};
/// ADPCM Predictor (4 bit) and Scale (4 bit)
union {
u16_le adpcm_ps;
BitField<0, 4, u16_le> adpcm_scale;
BitField<4, 4, u16_le> adpcm_predictor;
BitField<0, 4, u16> adpcm_scale;
BitField<4, 4, u16> adpcm_predictor;
};
/// ADPCM Historical Samples (y[n-1] and y[n-2])
@ -300,8 +300,8 @@ struct SourceConfiguration {
union {
u16_le flags2_raw;
BitField<0, 1, u16_le> adpcm_dirty; ///< Has the ADPCM info above been changed?
BitField<1, 1, u16_le> is_looping; ///< Is this a looping buffer?
BitField<0, 1, u16> adpcm_dirty; ///< Has the ADPCM info above been changed?
BitField<1, 1, u16> is_looping; ///< Is this a looping buffer?
};
/// Buffer id of embedded buffer (used as a buffer id in SourceStatus to reference this
@ -334,20 +334,20 @@ struct DspConfiguration {
union {
u32_le dirty_raw;
BitField<8, 1, u32_le> mixer1_enabled_dirty;
BitField<9, 1, u32_le> mixer2_enabled_dirty;
BitField<10, 1, u32_le> delay_effect_0_dirty;
BitField<11, 1, u32_le> delay_effect_1_dirty;
BitField<12, 1, u32_le> reverb_effect_0_dirty;
BitField<13, 1, u32_le> reverb_effect_1_dirty;
BitField<8, 1, u32> mixer1_enabled_dirty;
BitField<9, 1, u32> mixer2_enabled_dirty;
BitField<10, 1, u32> delay_effect_0_dirty;
BitField<11, 1, u32> delay_effect_1_dirty;
BitField<12, 1, u32> reverb_effect_0_dirty;
BitField<13, 1, u32> reverb_effect_1_dirty;
BitField<16, 1, u32_le> volume_0_dirty;
BitField<16, 1, u32> volume_0_dirty;
BitField<24, 1, u32_le> volume_1_dirty;
BitField<25, 1, u32_le> volume_2_dirty;
BitField<26, 1, u32_le> output_format_dirty;
BitField<27, 1, u32_le> limiter_enabled_dirty;
BitField<28, 1, u32_le> headphones_connected_dirty;
BitField<24, 1, u32> volume_1_dirty;
BitField<25, 1, u32> volume_2_dirty;
BitField<26, 1, u32> output_format_dirty;
BitField<27, 1, u32> limiter_enabled_dirty;
BitField<28, 1, u32> headphones_connected_dirty;
};
/// The DSP has three intermediate audio mixers. This controls the volume level (0.0-1.0) for
@ -384,9 +384,9 @@ struct DspConfiguration {
/// The DSP clears these each audio frame.
union {
u16_le dirty_raw;
BitField<0, 1, u16_le> enable_dirty;
BitField<1, 1, u16_le> work_buffer_address_dirty;
BitField<2, 1, u16_le> other_dirty; ///< Set when anything else has been changed
BitField<0, 1, u16> enable_dirty;
BitField<1, 1, u16> work_buffer_address_dirty;
BitField<2, 1, u16> other_dirty; ///< Set when anything else has been changed
};
u16_le enable;

View File

@ -129,18 +129,18 @@ struct ExHeader_StorageInfo {
u64_le ext_save_data_id;
// When using extended savedata access
// Prefer the ID specified in the most significant bits
BitField<40, 20, u64_le> extdata_id3;
BitField<20, 20, u64_le> extdata_id4;
BitField<0, 20, u64_le> extdata_id5;
BitField<40, 20, u64> extdata_id3;
BitField<20, 20, u64> extdata_id4;
BitField<0, 20, u64> extdata_id5;
};
u8 system_save_data_id[8];
union {
u64_le storage_accessible_unique_ids;
// When using extended savedata access
// Prefer the ID specified in the most significant bits
BitField<40, 20, u64_le> extdata_id0;
BitField<20, 20, u64_le> extdata_id1;
BitField<0, 20, u64_le> extdata_id2;
BitField<40, 20, u64> extdata_id0;
BitField<20, 20, u64> extdata_id1;
BitField<0, 20, u64> extdata_id2;
};
u8 access_info[7];
u8 other_attributes;

View File

@ -19,9 +19,9 @@ namespace Service::IR {
struct ExtraHIDResponse {
union {
BitField<0, 8, u32_le> header;
BitField<8, 12, u32_le> c_stick_x;
BitField<20, 12, u32_le> c_stick_y;
BitField<0, 8, u32> header;
BitField<8, 12, u32> c_stick_x;
BitField<20, 12, u32> c_stick_y;
} c_stick;
union {
BitField<0, 5, u8> battery_level;

View File

@ -27,13 +27,13 @@ namespace Service::IR {
union PadState {
u32_le hex{};
BitField<14, 1, u32_le> zl;
BitField<15, 1, u32_le> zr;
BitField<14, 1, u32> zl;
BitField<15, 1, u32> zr;
BitField<24, 1, u32_le> c_stick_right;
BitField<25, 1, u32_le> c_stick_left;
BitField<26, 1, u32_le> c_stick_up;
BitField<27, 1, u32_le> c_stick_down;
BitField<24, 1, u32> c_stick_right;
BitField<25, 1, u32> c_stick_left;
BitField<26, 1, u32> c_stick_up;
BitField<27, 1, u32> c_stick_down;
};
/// Interface to "ir:rst" service

View File

@ -231,8 +231,8 @@ private:
*/
union SegmentTag {
u32_le raw;
BitField<0, 4, u32_le> segment_index;
BitField<4, 28, u32_le> offset_into_segment;
BitField<0, 4, u32> segment_index;
BitField<4, 28, u32> offset_into_segment;
SegmentTag() = default;
explicit SegmentTag(u32 raw_) : raw(raw_) {}
@ -270,8 +270,8 @@ private:
u16_le test_bit; // bit address into the name to test
union Child {
u16_le raw;
BitField<0, 15, u16_le> next_index;
BitField<15, 1, u16_le> is_end;
BitField<0, 15, u16> next_index;
BitField<15, 1, u16> is_end;
} left, right;
u16_le export_table_index; // index of an ExportNamedSymbolEntry

View File

@ -45,20 +45,20 @@ struct ControllerState {
union {
u16_le hex;
BitField<0, 1, u16_le> a;
BitField<1, 1, u16_le> b;
BitField<2, 1, u16_le> select;
BitField<3, 1, u16_le> start;
BitField<4, 1, u16_le> right;
BitField<5, 1, u16_le> left;
BitField<6, 1, u16_le> up;
BitField<7, 1, u16_le> down;
BitField<8, 1, u16_le> r;
BitField<9, 1, u16_le> l;
BitField<10, 1, u16_le> x;
BitField<11, 1, u16_le> y;
BitField<12, 1, u16_le> debug;
BitField<13, 1, u16_le> gpio14;
BitField<0, 1, u16> a;
BitField<1, 1, u16> b;
BitField<2, 1, u16> select;
BitField<3, 1, u16> start;
BitField<4, 1, u16> right;
BitField<5, 1, u16> left;
BitField<6, 1, u16> up;
BitField<7, 1, u16> down;
BitField<8, 1, u16> r;
BitField<9, 1, u16> l;
BitField<10, 1, u16> x;
BitField<11, 1, u16> y;
BitField<12, 1, u16> debug;
BitField<13, 1, u16> gpio14;
// Bits 14-15 are currently unused
};
s16_le circle_pad_x;
@ -96,12 +96,12 @@ struct ControllerState {
union {
u32_le hex;
BitField<0, 5, u32_le> battery_level;
BitField<5, 1, u32_le> zl_not_held;
BitField<6, 1, u32_le> zr_not_held;
BitField<7, 1, u32_le> r_not_held;
BitField<8, 12, u32_le> c_stick_x;
BitField<20, 12, u32_le> c_stick_y;
BitField<0, 5, u32> battery_level;
BitField<5, 1, u32> zl_not_held;
BitField<6, 1, u32> zr_not_held;
BitField<7, 1, u32> r_not_held;
BitField<8, 12, u32> c_stick_x;
BitField<20, 12, u32> c_stick_y;
};
} extra_hid_response;
};

View File

@ -141,22 +141,22 @@ struct PadData {
// The following union isn't trivially copyable but we don't use this input anyway.
// union DigitalButton {
// u16_le button;
// BitField<0, 1, u16_le> button_1; // Share
// BitField<1, 1, u16_le> button_2; // L3
// BitField<2, 1, u16_le> button_3; // R3
// BitField<3, 1, u16_le> button_4; // Options
// BitField<4, 1, u16_le> button_5; // Up
// BitField<5, 1, u16_le> button_6; // Right
// BitField<6, 1, u16_le> button_7; // Down
// BitField<7, 1, u16_le> button_8; // Left
// BitField<8, 1, u16_le> button_9; // L2
// BitField<9, 1, u16_le> button_10; // R2
// BitField<10, 1, u16_le> button_11; // L1
// BitField<11, 1, u16_le> button_12; // R1
// BitField<12, 1, u16_le> button_13; // Triangle
// BitField<13, 1, u16_le> button_14; // Circle
// BitField<14, 1, u16_le> button_15; // Cross
// BitField<15, 1, u16_le> button_16; // Square
// BitField<0, 1, u16> button_1; // Share
// BitField<1, 1, u16> button_2; // L3
// BitField<2, 1, u16> button_3; // R3
// BitField<3, 1, u16> button_4; // Options
// BitField<4, 1, u16> button_5; // Up
// BitField<5, 1, u16> button_6; // Right
// BitField<6, 1, u16> button_7; // Down
// BitField<7, 1, u16> button_8; // Left
// BitField<8, 1, u16> button_9; // L2
// BitField<9, 1, u16> button_10; // R2
// BitField<10, 1, u16> button_11; // L1
// BitField<11, 1, u16> button_12; // R1
// BitField<12, 1, u16> button_13; // Triangle
// BitField<13, 1, u16> button_14; // Circle
// BitField<14, 1, u16> button_15; // Cross
// BitField<15, 1, u16> button_16; // Square
// } digital_button;
u8 home;