Commit 56e9f197 authored by Philippe Teuwen's avatar Philippe Teuwen

Fix warning increasing required alignment

acr122_usb.c:513:20: warning: cast from 'uint8_t *' (aka 'unsigned char *') to 'uint32_t *' (aka 'unsigned int *') increases required alignment from 1 to 4 [-Wcast-align]
  uint32_t *pu32 = (uint32_t *)u8;
                   ^~~~~~~~~~~~~~
parent cc7c0c32
......@@ -505,13 +505,15 @@ uint32_t htole32(uint32_t u32);
uint32_t
htole32(uint32_t u32)
{
uint8_t u8[4];
union {
uint8_t arr[4];
uint32_t u32;
} u;
for (int i = 0; i < 4; i++) {
u8[i] = (u32 & 0xff);
u.arr[i] = (u32 & 0xff);
u32 >>= 8;
}
uint32_t *pu32 = (uint32_t *)u8;
return *pu32;
return u.u32;
}
#endif /* !defined(htole32) */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment