1
0
Fork 0

Simplify assignments with type-sized host reads

This commit is contained in:
krcroft 2020-04-14 17:42:20 -07:00 committed by Patryk Obara
parent 7375db2a83
commit 54d805bd5c
2 changed files with 68 additions and 77 deletions

View file

@ -72,7 +72,7 @@ static INLINE uint16_t host_readw(const uint8_t *arr)
uint16_t val;
memcpy(&val, arr, sizeof(val));
// array sequence was DOS little-endian, so convert value to host-type
return le_to_host16(val);
return le16_to_host(val);
}
// Like the above, but allows index-style access assuming a 16-bit array
@ -105,7 +105,7 @@ static INLINE uint32_t host_readd(const uint8_t *arr)
uint32_t val;
memcpy(&val, arr, sizeof(val));
// array sequence was DOS little-endian, so convert value to host-type
return le_to_host32(val);
return le32_to_host(val);
}
// Like the above, but allows index-style access assuming a 32-bit array
@ -138,7 +138,7 @@ static INLINE uint64_t host_readq(const uint8_t *arr)
uint64_t val;
memcpy(&val, arr, sizeof(val));
// array sequence was DOS little-endian, so convert value to host-type
return le_to_host64(val);
return le64_to_host(val);
}
static INLINE void host_writeq(uint8_t *arr, uint64_t val)