Add alternate bitfield padding option
Adds configuration option CFG_TUSB_ALT_BIT_PACKING_ALIGNMENT, which substitutes bitfield variable " : 0" padding syntax with an unused variable of size equal to the remaining number of bits. This change resolves aligned access issues for some platforms. Default behavior is original if the option is not explicitly enabled.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019 Ha Thach (tinyusb.org)
|
||||
@@ -163,7 +163,11 @@ typedef struct {
|
||||
uint16_t high_speed : 1;
|
||||
uint16_t port_test_mode : 1;
|
||||
uint16_t port_indicator_control : 1;
|
||||
uint16_t : 0;
|
||||
#if CFG_TUSB_ALT_BIT_PACKING_ALIGNMENT
|
||||
uint16_t unused : 3;
|
||||
#else
|
||||
uint16_t : 0;
|
||||
#endif /* CFG_TUSB_ALT_BIT_PACKING_ALIGNMENT */
|
||||
};
|
||||
|
||||
uint16_t value;
|
||||
|
||||
Reference in New Issue
Block a user