ghst: use memcpy instead of for loop

PR review, ghost protocol, use memcpy instead of for loop

Co-authored-by: Beat Küng <beat-kueng@gmx.net>
This commit is contained in:
Juraj Ciberlin
2021-02-20 11:29:57 +01:00
committed by Lorenz Meier
co-authored by Beat Küng
parent 64342f568d
commit c0f7429f8c
+1 -3
View File
@@ -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");
}