Skip to content

Commit 3e2c364

Browse files
committed
Improve efficiency of checkHighRes verify loop
Marginally, at least. This will short-circuit the data verify loop early if a byte does not match.
1 parent 6627808 commit 3e2c364

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/controllers/ClassicController.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,10 @@ boolean ClassicController_Shared::checkHighRes(boolean *hr) const {
172172

173173
boolean equal = true;
174174
for (uint8_t i = 0; i < CheckSize; i++) {
175-
equal &= (checkData[i] == verifyData[i]);
175+
if (checkData[i] != verifyData[i]) {
176+
equal = false; // one byte does not match! quit
177+
break;
178+
}
176179
}
177180

178181
if (equal) break; // if data matches, continue

0 commit comments

Comments
 (0)