From a5f8e8e3d7be26eaaeb5b29d44d02879bd5d36de Mon Sep 17 00:00:00 2001 From: BlackMark Date: Sun, 29 May 2022 14:46:32 +0200 Subject: [PATCH] Fix volatile compound assignments being deprecated in C++20 --- hardware.hpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/hardware.hpp b/hardware.hpp index ff3f960..1efcef2 100644 --- a/hardware.hpp +++ b/hardware.hpp @@ -67,10 +67,12 @@ class Hardware { constexpr uint8_t ControlRegB = DataBitsValues.regBVal | EnableRx | EnableTx | InterruptVal; constexpr uint8_t ControlRegC = DataBitsValues.regCVal | ParityVal | StopBitsVal | ModeVal; + auto ctrlStatRegA = getRegPtr(); + if constexpr (UseDoubleSpeed) - *getRegPtr() |= (1 << CtrlFlagsA::SPEED_2X); + *ctrlStatRegA = *ctrlStatRegA | (1 << CtrlFlagsA::SPEED_2X); else - *getRegPtr() &= ~(1 << CtrlFlagsA::SPEED_2X); + *ctrlStatRegA = *ctrlStatRegA & ~(1 << CtrlFlagsA::SPEED_2X); *getRegPtr() = ControlRegB; *getRegPtr() = ControlRegC; @@ -130,12 +132,14 @@ class Hardware { static void enableDataRegEmptyInt() FORCE_INLINE { - *getRegPtr() |= (1 << CtrlFlagsB::DATA_REG_EMPTY_INT_ENABLE); + auto ctrlStatRegB = getRegPtr(); + *ctrlStatRegB = *ctrlStatRegB | (1 << CtrlFlagsB::DATA_REG_EMPTY_INT_ENABLE); } static void disableDataRegEmptyInt() FORCE_INLINE { - *getRegPtr() &= ~(1 << CtrlFlagsB::DATA_REG_EMPTY_INT_ENABLE); + auto ctrlStatRegB = getRegPtr(); + *ctrlStatRegB = *ctrlStatRegB & ~(1 << CtrlFlagsB::DATA_REG_EMPTY_INT_ENABLE); } private: