surpressed all style warnings from the LSP server.

This commit is contained in:
Linus Björnstam 2026-05-21 13:13:22 +02:00
parent 7ee2238248
commit 23c4ac299e
13 changed files with 346 additions and 371 deletions

View file

@ -5,21 +5,21 @@ using System.Runtime.CompilerServices;
/// A universal key strategy for any type that relies on standard comparisons
/// (IComparable, IComparer, or custom StringComparers) without SIMD prefixes.
/// </summary>
public readonly struct StandardStrategy<K> : IKeyStrategy<K>
public readonly struct StandardStrategy<TK> : IKeyStrategy<TK>
{
private readonly IComparer<K> _comparer;
private readonly IComparer<TK> _comparer;
// If no comparer is provided, it defaults to Comparer<K>.Default
// which automatically uses IComparable<K> if the type implements it.
public StandardStrategy()
{
_comparer = Comparer<K>.Default;
_comparer = Comparer<TK>.Default;
}
public StandardStrategy(IComparer<K>? comparer)
public StandardStrategy(IComparer<TK>? comparer)
{
_comparer = comparer ?? Comparer<K>.Default;
_comparer = comparer ?? Comparer<TK>.Default;
}
// Tell the B-Tree to skip SIMD routing and just use LinearSearch
public bool UsesPrefixes => false;
@ -27,16 +27,16 @@ public readonly struct StandardStrategy<K> : IKeyStrategy<K>
// This will never be called because UsesPrefixes is false,
// but we must satisfy the interface.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public long GetPrefix(K key) => 0;
public long GetPrefix(TK key) => 0;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int Compare(K x, K y)
public int Compare(TK x, TK y)
{
return _comparer.Compare(x, y);
}
}
public readonly struct StandardStrategy2<K, TComparer> : IKeyStrategy<K>
where TComparer : struct, IComparer<K>
public readonly struct StandardStrategy2<TK, TComparer> : IKeyStrategy<TK>
where TComparer : struct, IComparer<TK>
{
private readonly TComparer _comparer;
@ -46,8 +46,8 @@ public readonly struct StandardStrategy2<K, TComparer> : IKeyStrategy<K>
public bool UseBinarySearch => true;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int Compare(K x, K y) => _comparer.Compare(x, y);
public int Compare(TK x, TK y) => _comparer.Compare(x, y);
public long GetPrefix(K key) => 0;
public long GetPrefix(TK key) => 0;
}