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

Merge pull request #828 from lioncash/seq

hid: Get rid of undefined behavior
This commit is contained in:
Yuri Kunde Schlesner 2015-05-27 11:50:57 -07:00
commit 3c47522e67

View file

@ -58,7 +58,7 @@ void Update() {
mem->pad.current_state.hex = state.hex; mem->pad.current_state.hex = state.hex;
mem->pad.index = next_pad_index; mem->pad.index = next_pad_index;
++next_touch_index %= mem->pad.entries.size(); next_touch_index = (next_touch_index + 1) % mem->pad.entries.size();
// Get the previous Pad state // Get the previous Pad state
u32 last_entry_index = (mem->pad.index - 1) % mem->pad.entries.size(); u32 last_entry_index = (mem->pad.index - 1) % mem->pad.entries.size();
@ -88,7 +88,7 @@ void Update() {
} }
mem->touch.index = next_touch_index; mem->touch.index = next_touch_index;
++next_touch_index %= mem->touch.entries.size(); next_touch_index = (next_touch_index + 1) % mem->touch.entries.size();
// Get the current touch entry // Get the current touch entry
TouchDataEntry* touch_entry = &mem->touch.entries[mem->touch.index]; TouchDataEntry* touch_entry = &mem->touch.entries[mem->touch.index];