1
0
Fork 0

Use type-specific host conversion funcs

This commit is contained in:
krcroft 2020-04-14 17:41:19 -07:00 committed by Patryk Obara
parent 297229700c
commit 7375db2a83
2 changed files with 8 additions and 8 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_host(val);
return le_to_host16(val);
}
// Like the above, but allows index-style access assuming a 16-bit array
@ -84,7 +84,7 @@ static INLINE uint16_t host_readw_at(const uint8_t *arr, const uintptr_t index)
static INLINE void host_writew(uint8_t *arr, uint16_t val)
{
// Convert the host-type value to little-endian before filling array
val = host_to_le(val);
(val) = host_to_le16(val);
memcpy(arr, &val, sizeof(val));
}
@ -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_host(val);
return le_to_host32(val);
}
// Like the above, but allows index-style access assuming a 32-bit array
@ -117,7 +117,7 @@ static INLINE uint32_t host_readd_at(const uint8_t *arr, const uintptr_t index)
static INLINE void host_writed(uint8_t *arr, uint32_t val)
{
// Convert the host-type value to little-endian before filling array
val = host_to_le(val);
(val) = host_to_le32(val);
memcpy(arr, &val, sizeof(val));
}
@ -138,13 +138,13 @@ 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_host(val);
return le_to_host64(val);
}
static INLINE void host_writeq(uint8_t *arr, uint64_t val)
{
// Convert the host-type value to little-endian before filling array
val = host_to_le(val);
(val) = host_to_le64(val);
memcpy(arr, &val, sizeof(val));
}

View file

@ -505,8 +505,8 @@ static void MIXER_MixData(Bitu needed) {
const int32_t sample_2 = mixer.work[readpos][1] >> MIXER_VOLSHIFT;
const int16_t s1 = MIXER_CLIP(sample_1);
const int16_t s2 = MIXER_CLIP(sample_2);
convert[i][0] = host_to_le(static_cast<uint16_t>(s1));
convert[i][1] = host_to_le(static_cast<uint16_t>(s2));
convert[i][0] = host_to_le16(s1);
convert[i][1] = host_to_le16(s2);
readpos = (readpos + 1) & MIXER_BUFMASK;
}
CAPTURE_AddWave(mixer.freq, added, reinterpret_cast<int16_t*>(convert));