File tree Expand file tree Collapse file tree 2 files changed +9
-11
lines changed Expand file tree Collapse file tree 2 files changed +9
-11
lines changed Original file line number Diff line number Diff line change 2
2
3
3
uint8_t program [PROGRAM_MAX_SIZE ];
4
4
5
- struct value get_integer (uint16_t position , uint8_t size )
5
+ union value get_integer (uint16_t position , uint8_t size )
6
6
{
7
- struct value value ;
7
+ union value value ;
8
8
9
9
switch (size ) {
10
10
case 1 :
Original file line number Diff line number Diff line change 3
3
4
4
#include "stdlib.h"
5
5
6
- struct value {
7
- uint8_t raw []; // TODO: check the empty square brackets
8
- union {
9
- uint8_t u8 ;
10
- uint16_t u16 ;
11
- int32_t i32 ;
12
- uint32_t u32 ;
13
- };
6
+ union value {
7
+ uint8_t raw [4 ];
8
+ uint8_t u8 ;
9
+ uint16_t u16 ;
10
+ int32_t i32 ;
11
+ uint32_t u32 ;
14
12
};
15
13
16
14
static const int PROGRAM_MAX_SIZE = 65536 ;
17
15
18
16
extern uint8_t program [PROGRAM_MAX_SIZE ];
19
17
20
- struct value get_integer (uint16_t position , uint8_t size );
18
+ union value get_integer (uint16_t position , uint8_t size );
21
19
22
20
#endif /* end of include guard: PROGRAM_H */
You can’t perform that action at this time.
0 commit comments