Browse Source

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>
release/1.12
Juraj Ciberlin 4 years ago committed by Lorenz Meier
parent
commit
c0f7429f8c
  1. 4
      src/lib/rc/ghst.cpp

4
src/lib/rc/ghst.cpp

@ -203,9 +203,7 @@ static bool ghst_parse_buffer(uint16_t *values, int8_t *rssi, uint16_t *num_valu @@ -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");
}

Loading…
Cancel
Save