/* Inspects an S1, S2 or S3 line from a Motorola S-Record file to determine if the checksum at the end is corrrect.  */
static bool SRecParserVerifyChecksum(char const *line)
/* Inspects an S1, S2 or S3 line from a Motorola S-Record file to determine if the checksum at the end is corrrect.  */
static bool SRecParserVerifyChecksum(char const *line)
{
  bool result = false;
  uint8_t bytes_on_line;
  uint8_t checksum = 0;
  assert(line != NULL);
  if (line != NULL)
  {
    line += 2u;
    bytes_on_line = SRecParserHexStringToByte(line);
    if (bytes_on_line >= 3u)
    {
      checksum += bytes_on_line;
      line += 2u;
      do
      {
        checksum += SRecParserHexStringToByte(line);
        bytes_on_line--;
        line += 2u;
      }
      while (bytes_on_line > 1u);
      checksum = ~checksum;
      if (checksum == SRecParserHexStringToByte(line))
      {
        result = true;
      }
    }
  }
  return result;
}