From 45a2008aa6c7c43da6182cb3d6c96b7ab86902ac Mon Sep 17 00:00:00 2001 From: lizzie Date: Fri, 7 Nov 2025 17:03:01 +0100 Subject: [common] replace Common::(DerivedFrom, IsArithmetic, Size, ConvertibleTo, IsIntegral) with libstdc++ equivalents (#290) Signed-off-by: lizzie Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/290 Reviewed-by: crueter Reviewed-by: Caio Oliveira Co-authored-by: lizzie Co-committed-by: lizzie --- src/common/fixed_point.h | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src/common/fixed_point.h') diff --git a/src/common/fixed_point.h b/src/common/fixed_point.h index b0f3ae2ccb..c52c870812 100644 --- a/src/common/fixed_point.h +++ b/src/common/fixed_point.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: 2015 Evan Teran // SPDX-License-Identifier: MIT @@ -16,6 +19,10 @@ namespace Common { +// No equivalent for "std::arithmetic" in the stdlib +template +concept IsArithmetic = std::is_arithmetic_v; + template class FixedPoint; @@ -392,13 +399,13 @@ public: // binary math operators, effects underlying bit pattern since these return *this; } - template + template constexpr FixedPoint& operator>>=(Integer n) { data_ >>= n; return *this; } - template + template constexpr FixedPoint& operator<<=(Integer n) { data_ <<= n; return *this; @@ -587,12 +594,12 @@ constexpr FixedPoint operator/(Number lhs, FixedPoint rhs) { } // shift operators -template +template constexpr FixedPoint operator<<(FixedPoint lhs, Integer rhs) { lhs <<= rhs; return lhs; } -template +template constexpr FixedPoint operator>>(FixedPoint lhs, Integer rhs) { lhs >>= rhs; return lhs; -- cgit v1.2.3