started changing to valuetuple

This commit is contained in:
Linus Björnstam 2026-04-28 21:52:24 +02:00
parent b5b363ae9f
commit bf8298658c

View file

@ -333,11 +333,11 @@ namespace PersistentMap
// Insertion Logic // Insertion Logic
// --------------------------------------------------------- // ---------------------------------------------------------
private class SplitResult<K> private class SeplitResult<K>
{ {
public Node<K> NewNode; public Node<K> NewNode;
public K Separator; public K Separator;
public SplitResult(Node<K> newNode, K separator) public SeplitResult(Node<K> newNode, K separator)
{ {
NewNode = newNode; NewNode = newNode;
Separator = separator; Separator = separator;
@ -371,7 +371,7 @@ namespace PersistentMap
leaf.SetCount(count + 1); leaf.SetCount(count + 1);
} }
private static SplitResult<K> SplitLeaf<K, V, TStrategy>(LeafNode<K, V> left, int insertIndex, K key, V value, TStrategy strategy, OwnerId owner) private static (Node<K>, K) SplitLeaf<K, V, TStrategy>(LeafNode<K, V> left, int insertIndex, K key, V value, TStrategy strategy, OwnerId owner)
where TStrategy : IKeyStrategy<K> where TStrategy : IKeyStrategy<K>
{ {
var right = new LeafNode<K, V>(owner, strategy.UsesPrefixes); var right = new LeafNode<K, V>(owner, strategy.UsesPrefixes);
@ -403,7 +403,7 @@ namespace PersistentMap
InsertIntoLeaf(right, insertIndex - splitPoint, key, value, strategy); InsertIntoLeaf(right, insertIndex - splitPoint, key, value, strategy);
} }
return new SplitResult<K>(right, right.Keys[0]); return (right, right.Keys[0]);
} }
private static void InsertIntoInternal<K, TStrategy>(InternalNode<K> node, int index, K separator, Node<K> newChild, TStrategy strategy) private static void InsertIntoInternal<K, TStrategy>(InternalNode<K> node, int index, K separator, Node<K> newChild, TStrategy strategy)
@ -437,7 +437,7 @@ namespace PersistentMap
node.SetCount(count + 1); node.SetCount(count + 1);
} }
private static SplitResult<K> SplitInternal<K, TStrategy>(InternalNode<K> left, int insertIndex, K separator, Node<K> newChild, TStrategy strategy, OwnerId owner) private static (Node<K>, K) SplitInternal<K, TStrategy>(InternalNode<K> left, int insertIndex, K separator, Node<K> newChild, TStrategy strategy, OwnerId owner)
where TStrategy : IKeyStrategy<K> where TStrategy : IKeyStrategy<K>
{ {
var right = strategy.UsesPrefixes var right = strategy.UsesPrefixes
@ -477,7 +477,7 @@ namespace PersistentMap
InsertIntoInternal(right, insertIndex - (splitPoint + 1), separator, newChild, strategy); InsertIntoInternal(right, insertIndex - (splitPoint + 1), separator, newChild, strategy);
} }
return new SplitResult<K>(right, upKey); return (right, upKey);
} }
// --------------------------------------------------------- // ---------------------------------------------------------