Advertisement
Guest User

siatki sw

a guest
Apr 26th, 2018
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.98 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <stdlib.h>
  4.  
  5. unsigned char F1 = {1, 11, 13, 22, 25, 36, 47, 50, 57, 61, 255};
  6. unsigned char F0 = {3, 7, 8, 10, 14, 23, 28, 35, 39, 40, 44, 48, 42, 46, 51, 60, 255};
  7.  
  8. unsigned char F[64];
  9. unsigned char i, k, FC, ERR;
  10.  
  11. void fill(void){
  12.     unsigned char i, k;
  13.         for(i=0; i<64; F[i++]=255);
  14.  
  15.             i = 0; while ((k = F1[i++])!=255) F[k] = 1;
  16.             i = 0; while ((k = F0[i++])!=255) F[k] = 0;
  17.         }
  18.  
  19. unsigned char check(void){
  20.     unsigned char a, b, c, d, e, f;
  21.     unsigned char i, k, FC, ERR;
  22.  
  23.     for(k = 0; k < 64; k++){
  24.         f = (k >> 5) & 0x01;
  25.         e = (k >> 4) & 0x01;
  26.         d = (k >> 3) & 0x01;
  27.         c = (k >> 2) & 0x01;
  28.         b = (k >> 1) & 0x01;
  29.         a = k & 0x01;
  30.  
  31.         FC = (funkcja);
  32.         //FC = (funkcja 2);
  33.  
  34.         if (FC != F[k] && (unsigned char)F[k] != 255) return k;
  35.     }
  36.     return 255;
  37. }
  38.  
  39. int main(){
  40.     fill();
  41.     ERR = check();
  42.     //for(i = 0; i < 64; ++i) printf("%3d", (int)F[i]);
  43.     if(ERR == 255) printf("OK!");
  44.     else printf("ERROR %d", (int)ERR);
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement