Advertisement
Guest User

Untitled

a guest
Apr 19th, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. #include <stdint.h>
  2.  
  3. #include <stdlib.h>
  4.  
  5. #include <stdio.h>
  6.  
  7. struct pair
  8. {
  9. uint32_t instruction;
  10. uint8_t prefix_length;
  11. };
  12.  
  13. typedef struct
  14. {
  15. uint8_t *start;
  16. uint8_t buffer[4096];
  17. struct pair table[1];
  18. } branch;
  19.  
  20. static char text[] = "boiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii";
  21.  
  22. int main()
  23. {
  24. branch *crc[2][2] =
  25. {
  26. {
  27. malloc(sizeof(branch) + sizeof(struct pair) * 2),
  28. malloc(sizeof(branch) + sizeof(struct pair) * 2)
  29. },
  30. {
  31. malloc(sizeof(branch) + sizeof(struct pair) * 2),
  32. malloc(sizeof(branch) + sizeof(struct pair) * 2)
  33. },
  34. };
  35.  
  36. for (uint16_t i = 0; i < sizeof crc[0][0]->buffer; i++)
  37. crc[0][0]->buffer[i] = text[i];
  38.  
  39. crc[0][0]->table[0].instruction = 13333337;
  40. crc[0][0]->table[0].prefix_length = 1;
  41. crc[0][0]->table[1].instruction = 13333337;
  42. crc[0][0]->table[1].prefix_length = 1;
  43.  
  44. crc[0][0]->start = (uint8_t *)text;
  45. printf("%08x:%s\n%08x:%s\n", crc[0][0]->start, crc[0][0]->start, crc[0][0]->buffer, crc[0][0]->buffer);
  46.  
  47. getchar();
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement