]>
Commit | Line | Data |
---|---|---|
81f80d8c MF |
1 | typedef unsigned char u8; |
2 | typedef unsigned short u16; | |
3 | ||
4 | struct s { | |
5 | u8 anchor[5]; | |
6 | u16 table_length; | |
7 | }; | |
8 | ||
9 | void some_function(int x); | |
10 | ||
11 | void other_function(const struct s *pointer) | |
12 | { | |
13 | u8 checksum = 0; | |
14 | const u8 *ptr = (const u8 *)(pointer); | |
15 | ||
16 | for (unsigned int i = 0; i < sizeof(*pointer); ++i) | |
17 | checksum = (checksum + ptr[i]) & 0xFF; | |
18 | ||
19 | some_function((int)checksum); | |
20 | } |