From c0f7429f8c601c3b4d51c947866f64b6d82fc9dd Mon Sep 17 00:00:00 2001 From: Juraj Ciberlin Date: Mon, 15 Feb 2021 19:01:39 +0100 Subject: [PATCH] ghst: use memcpy instead of for loop MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR review, ghost protocol, use memcpy instead of for loop Co-authored-by: Beat Küng --- src/lib/rc/ghst.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/lib/rc/ghst.cpp b/src/lib/rc/ghst.cpp index c8b2febc82..cf49885dea 100644 --- a/src/lib/rc/ghst.cpp +++ b/src/lib/rc/ghst.cpp @@ -203,9 +203,7 @@ static bool ghst_parse_buffer(uint16_t *values, int8_t *rssi, uint16_t *num_valu // discard most of the data, but keep the last 3 bytes (otherwise we could miss the frame start) current_frame_position = 3; - for (unsigned i = 0; i < current_frame_position; ++i) { - ghst_frame_ptr[i] = ghst_frame_ptr[sizeof(ghst_frame_t) - current_frame_position + i]; - } + memcpy(ghst_frame_ptr, ghst_frame_ptr + sizeof(ghst_frame_t) - current_frame_position, current_frame_position); GHST_VERBOSE("Discarding buffer"); }