From 03efc31f9c070947cb35a4ab21db75fb8e450330 Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Sat, 16 Oct 2021 10:04:19 -0700 Subject: [PATCH] powctl: don't require arm64 arch for floating -> fixed conversion --- .../impl/board/nintendo/nx/powctl_max17050_driver.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/libraries/libstratosphere/source/powctl/impl/board/nintendo/nx/powctl_max17050_driver.cpp b/libraries/libstratosphere/source/powctl/impl/board/nintendo/nx/powctl_max17050_driver.cpp index 66448f14d..0c5c8c7f1 100644 --- a/libraries/libstratosphere/source/powctl/impl/board/nintendo/nx/powctl_max17050_driver.cpp +++ b/libraries/libstratosphere/source/powctl/impl/board/nintendo/nx/powctl_max17050_driver.cpp @@ -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(static_cast(percentage * (1 << 8))); + /* Set the threshold. */ return WriteRegister(m_i2c_session, max17050::FullSocThr, val); }