Tiny optimization

This commit is contained in:
mlemanczyk committed 2025-10-12 19:00:56 +02:00
1 parent e5486af49d
commit 9e5ee36e6e
1 file changed
+2 -3
+2 -3
View File
@@ -15,7 +15,6 @@ internal struct MutableUInt128
public MutableUInt128(ulong value)
{
High = 0UL;
Low = value;
}
@@ -53,7 +52,7 @@ internal struct MutableUInt128
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public UInt128 ToUInt128() => ((UInt128)High << 64) | Low;
public readonly UInt128 ToUInt128() => ((UInt128)High << 64) | Low;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Add(ulong value)
@@ -71,10 +70,10 @@ internal struct MutableUInt128
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;
Low = low;
High = high;
}