17 lines
541 B
C#
17 lines
541 B
C#
namespace PersistentOrderedMap;
|
|
|
|
using System.Runtime.CompilerServices;
|
|
|
|
// This is a comparable strategy that may squeeze some extra time out of value types
|
|
|
|
public readonly struct ComparableStrategy<TK> : IKeyStrategy<TK> where TK : IComparable<TK>
|
|
{
|
|
public bool UsesPrefixes => false;
|
|
public bool UseBinarySearch => true;
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public long GetPrefix(TK key) => 0;
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public int Compare(TK x, TK y) => x.CompareTo(y);
|
|
}
|