Advertisement
Guest User

Untitled

a guest
May 18th, 2018
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.42 KB | None | 0 0
  1. uint8_t S[8] = {0x00, 0x01, 0xAC, 0xff, 0xfd, 0xfe, 0x21, 0x45}, O[8] = {0x00, 0x01, 0xAD, 0xff, 0xfd, 0xfe, 0x21, 0x45};
  2. uint16_t E = 0; //eoor count
  3.  
  4. uint16_t BER(uint8_t *Src, uint8_t *Org, uint16_t len)
  5. {
  6.     uint8_t XR = 0;
  7.     uint16_t err = 0;
  8.     for (int cnt = 0; cnt < len; cnt++)
  9.     {
  10.         XR = *(Src+cnt) ^ *(Org+cnt);
  11.         for (int lcn = 0; lcn < 8; lcn++)
  12.         {
  13.             if (XR >> lcn & 1) err++;
  14.         }
  15.     }
  16.     return err;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement