From 8c0320d8379ad84208e33fa6d9d6a4d78aba9c90 Mon Sep 17 00:00:00 2001 From: mlemanczyk Date: Sun, 12 Oct 2025 20:25:43 +0200 Subject: [PATCH] Add optimized --- PerfectNumbers.Core/MutableUInt128.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/PerfectNumbers.Core/MutableUInt128.cs b/PerfectNumbers.Core/MutableUInt128.cs index 1558f92..e318137 100644 --- a/PerfectNumbers.Core/MutableUInt128.cs +++ b/PerfectNumbers.Core/MutableUInt128.cs @@ -69,12 +69,12 @@ public struct MutableUInt128 [MethodImpl(MethodImplOptions.AggressiveInlining)] public void Add(in MutableUInt128 value) { - ulong low = Low + value.Low; - Low = low; - ulong carry = low < Low ? 1UL : 0UL; - ulong high = High + value.High + carry; - - High = high; + ulong temp = Low + value.Low; + Low = temp; + temp = temp < Low ? 1UL : 0UL; + temp += High; + temp += value.High; + High = temp; } [MethodImpl(MethodImplOptions.AggressiveInlining)]