title: 8-bit fletcher checksum of 16 byte data
body: <p>I'm trying to implement a 8-bit fletcher checksum function.</p>
  
  <p>My data will always be 17 byte long.</p>
  
  <p>I started with code from <a href="https://stackoverflow.com/questions/8925018/remake-of-fletcher-checksum-from-32bit-to-8">Remake of Fletcher checksum from 32bit to 8</a></p>
  
  <p>Here is what I ended up having :</p>
  
  <pre class="lang-c prettyprint-override"><code>// 8-bit Fletcher checksum
  //   data is always 17 byte long
  uint8_t fletcher(uint8_t *data) {
      uint8_t sum1 = 0x0f, sum2 = 0x0f, len = 17;
  
      while(len) {
          sum1 += *data++;
          sum2 += sum1;
          sum1 = (sum1 &amp; 0x0f) + (sum1 &gt;&gt; 4);
          sum2 = (sum2 &amp; 0x0f) + (sum2 &gt;&gt; 4);
          len--;
      }
      sum1 = (sum1 &amp; 0x0f) + (sum1 &gt;&gt; 4);
      sum2 = (sum2 &amp; 0x0f) + (sum2 &gt;&gt; 4);
      return sum2&lt;&lt;4 | sum1;
  }
  </code></pre>
  
  <p>I'm wondering if it is good and I have the impression that I could simplify further but I can't find where (maybe it just can't be simplified further after all ...).</p>
  
  <p>My main question is whether this code looks it will work okay. I am using it at both sides of a wireless based data link it will "work" (return the same checksum from the same data) but may be wrong in the fletcher way and not provide the expected error detection ...</p>
  
  <p>Hope I'm clear enough ...</p>
  
  <p>Thanks in advance !</p>