Fix scan-build warning: cast increases required alignment from 1 to 4
acr122_usb.c:562: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; ^~~~~~~~~~~~~~
This commit is contained in:
parent
048ed88e16
commit
1c67c3f92a
1 changed files with 1 additions and 7 deletions
|
@ -554,13 +554,7 @@ uint32_t htole32(uint32_t u32);
|
|||
uint32_t
|
||||
htole32(uint32_t u32)
|
||||
{
|
||||
uint8_t u8[4];
|
||||
for (int i = 0; i < 4; i++) {
|
||||
u8[i] = (u32 & 0xff);
|
||||
u32 >>= 8;
|
||||
}
|
||||
uint32_t *pu32 = (uint32_t *)u8;
|
||||
return *pu32;
|
||||
return (((u32 & 0xff) << 24) + ((u32 & 0xff00) << 8) + ((u32 & 0xff0000) >> 8) + (u32 >> 24));
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
Loading…
Reference in a new issue