powctl: don't require arm64 arch for floating -> fixed conversion

This commit is contained in:
Michael Scire 2021-10-16 10:04:19 -07:00
parent f7f83b4742
commit 03efc31f9c

View file

@ -564,12 +564,10 @@ namespace ams::powctl::impl::board::nintendo::nx {
}
Result Max17050Driver::SetFullChargeThreshold(double percentage) {
#if defined(ATMOSPHERE_ARCH_ARM64)
const u16 val = vcvtd_n_s64_f64(percentage, BITSIZEOF(u8));
#else
#error "Unknown architecture for floating point -> fixed point"
#endif
/* Convert percentage from double to signed fixed-point with 8 fractional bits. */
const u16 val = static_cast<u16>(static_cast<s16>(percentage * (1 << 8)));
/* Set the threshold. */
return WriteRegister(m_i2c_session, max17050::FullSocThr, val);
}