MCPcopy Create free account
hub / github.com/PowerBroker2/SerialTransfer / findLast

Method findLast

src/Packet.cpp:351–358  ·  view source on GitHub ↗

int16_t Packet::findLast(uint8_t arr[], const uint8_t &len) Description: ------------ * Finds last instance of the value START_BYTE within the given packet array Inputs: ------- * uint8_t arr[] - Packet array * const uint8_t &len - Number of elements in arr[] Return: ------- * int16_t - Index of last instance of the value START_BYTE within the given packet array */

Source from the content-addressed store, hash-verified

349 packet array
350*/
351int16_t Packet::findLast(uint8_t arr[], const uint8_t& len)
352{
353 for (uint8_t i = (len - 1); i != 0xFF; i--)
354 if (arr[i] == START_BYTE)
355 return i;
356
357 return -1;
358}
359
360
361/*

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected