aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Lioncash <mathew1800@gmail.com>2015-05-27 12:20:09 -0400
committerGravatar Lioncash <mathew1800@gmail.com>2015-05-27 12:20:12 -0400
commita3cad6c33214f5a69f4ea41555bcbd3646fc1907 (patch)
tree17f8e8f42c181af07f34bfc21240b139890a34e4 /src
parentad883db7a92dd48761982923c5ec594d268a2aff (diff)
hid: Get rid of undefined behavior
Modifying a variable twice across a sequence point.
Diffstat (limited to 'src')
-rw-r--r--src/core/hle/service/hid/hid.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp
index 2d2133b2..feac5381 100644
--- a/src/core/hle/service/hid/hid.cpp
+++ b/src/core/hle/service/hid/hid.cpp
@@ -58,7 +58,7 @@ void Update() {
mem->pad.current_state.hex = state.hex;
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
u32 last_entry_index = (mem->pad.index - 1) % mem->pad.entries.size();
@@ -88,7 +88,7 @@ void Update() {
}
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
TouchDataEntry* touch_entry = &mem->touch.entries[mem->touch.index];