From 8d3e1779dd1a6efa29541ed821e26a503b613673 Mon Sep 17 00:00:00 2001 From: Bryant Mairs Date: Sun, 15 Jun 2014 14:13:39 -0700 Subject: [PATCH] Replaced expensive modulus operation with bitwise-and. --- src/comm/MAVLinkProtocol.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/comm/MAVLinkProtocol.cc b/src/comm/MAVLinkProtocol.cc index 3ff291b5a..66ba6dc3a 100644 --- a/src/comm/MAVLinkProtocol.cc +++ b/src/comm/MAVLinkProtocol.cc @@ -503,7 +503,7 @@ void MAVLinkProtocol::receiveBytes(LinkInterface* link, QByteArray b) lastIndex[message.sysid][message.compid] = expectedSeq; // Update on every 32th packet - if (totalReceiveCounter[linkId] % 32 == 0) + if ((totalReceiveCounter[linkId] & 0x1F) == 0) { // Calculate new loss ratio // Receive loss -- 2.22.0