diff options
| author | hathach <[email protected]> | 2021-10-15 17:35:05 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2021-10-15 23:54:31 +0700 |
| commit | 0b249618b0469529da748e3e5478751cd56acd31 (patch) | |
| tree | 48fde1b0c69e2d27bd4d3ccc963a6d3ecd6c2546 /src/common/tusb_common.h | |
| parent | 7596cb30797c625a0523e0f68ef65296740538e0 (diff) | |
fix -Wcast-qual
Diffstat (limited to 'src/common/tusb_common.h')
| -rw-r--r-- | src/common/tusb_common.h | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/common/tusb_common.h b/src/common/tusb_common.h index fc4d3bc62..8dd1dbd49 100644 --- a/src/common/tusb_common.h +++ b/src/common/tusb_common.h @@ -161,7 +161,6 @@ static inline uint8_t tu_log2(uint32_t value) #if TUP_ARCH_STRICT_ALIGN // Rely on compiler to generate correct code for unaligned access - typedef struct { uint16_t val; } TU_ATTR_PACKED tu_unaligned_uint16_t; typedef struct { uint32_t val; } TU_ATTR_PACKED tu_unaligned_uint32_t; @@ -227,8 +226,8 @@ TU_ATTR_ALWAYS_INLINE static inline void tu_unaligned_write16(void* mem, uint16_ #else // MCU that could access unaligned memory natively -TU_ATTR_ALWAYS_INLINE static inline uint32_t tu_unaligned_read32 (const void* mem ) { return *((uint32_t*) mem); } -TU_ATTR_ALWAYS_INLINE static inline uint16_t tu_unaligned_read16 (const void* mem ) { return *((uint16_t*) mem); } +TU_ATTR_ALWAYS_INLINE static inline uint32_t tu_unaligned_read32 (const void* mem) { return *((uint32_t const *) mem); } +TU_ATTR_ALWAYS_INLINE static inline uint16_t tu_unaligned_read16 (const void* mem) { return *((uint16_t const *) mem); } TU_ATTR_ALWAYS_INLINE static inline void tu_unaligned_write32 (void* mem, uint32_t value ) { *((uint32_t*) mem) = value; } TU_ATTR_ALWAYS_INLINE static inline void tu_unaligned_write16 (void* mem, uint16_t value ) { *((uint16_t*) mem) = value; } |
