From b7d80f1340c89e1ebbe9ff62d9c1d839f15a81f9 Mon Sep 17 00:00:00 2001 From: Werner Almesberger Date: Wed, 20 Jun 2012 16:46:27 -0300 Subject: [PATCH] fw/fw.c: simplify the use of the sequence number a little (untested) Not sure if this even produces better code. It looks a bit cleaner, though. --- fw/fw.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fw/fw.c b/fw/fw.c index 8609653..bc804ed 100644 --- a/fw/fw.c +++ b/fw/fw.c @@ -74,7 +74,7 @@ bool fw_packet(const uint8_t *buf, uint8_t len) /* Synchronize sequence numbers */ if (!buf[1]) { - seq = buf[1]; + seq = 0; limit = buf[2]; } else { if (buf[2] != limit) @@ -87,7 +87,7 @@ bool fw_packet(const uint8_t *buf, uint8_t len) /* Process the payload */ - if (!fw_payload(buf[1], limit, buf+3)) + if (!fw_payload(seq, limit, buf+3)) return 0; seq++; ack: