Fixed the unicode strategy to avoid boxing
This commit is contained in:
parent
7af48306fe
commit
a54b17167e
1 changed files with 4 additions and 2 deletions
|
|
@ -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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue