Fixed the unicode strategy to avoid boxing

This commit is contained in:
Linus Björnstam 2026-04-23 17:08:12 +02:00
parent 7af48306fe
commit a54b17167e

View file

@ -16,7 +16,6 @@ public interface IKeyStrategy<K>
bool UsesPrefixes => true; bool UsesPrefixes => true;
//
bool IsLossless => false; bool IsLossless => false;
bool UseBinarySearch => false; bool UseBinarySearch => false;
} }
@ -26,6 +25,10 @@ public interface IKeyStrategy<K>
public struct UnicodeStrategy : IKeyStrategy<string> public struct UnicodeStrategy : IKeyStrategy<string>
{ {
bool UsesPrefixes => true;
bool UseBinarySearch => false;
bool IsLossLess => false;
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public int Compare(string? x, string? y) => string.CompareOrdinal(x, y); public int Compare(string? x, string? y) => string.CompareOrdinal(x, y);
@ -58,7 +61,6 @@ public struct UnicodeStrategy : IKeyStrategy<string>
return packed ^ unchecked((long)0x8080808080808080); return packed ^ unchecked((long)0x8080808080808080);
} }
public bool UsesPrefixes => true;
} }