]>
Commit | Line | Data |
---|---|---|
81f80d8c MF |
1 | #include <stdio.h> |
2 | ||
3 | typedef unsigned char u8; | |
4 | typedef unsigned short u16; | |
5 | ||
6 | struct s { | |
7 | u8 anchor[5]; | |
8 | u16 table_length; | |
9 | } __attribute__((packed)); | |
10 | ||
11 | void some_function(int x); | |
12 | ||
13 | void other_function(const struct s *pointer) | |
14 | { | |
15 | u8 checksum = 0; | |
16 | const u8 *ptr = (const u8 *)(pointer); | |
17 | ||
18 | for (unsigned int i = 0; i < 7; ++i) | |
19 | printf("%x\n", ptr[i]); | |
20 | // checksum = (checksum + ptr[i]) & 0xFF; | |
21 | ||
22 | printf("%x\n", checksum); | |
23 | // some_function((int)checksum); | |
24 | } | |
25 | ||
26 | int main() { | |
27 | printf("%lu\n", sizeof(struct s)); | |
28 | return 0; | |
29 | } |