2026-05-07 07:44:55 +02:00
|
|
|
namespace PersistentOrderedMap;
|
2026-04-23 16:45:18 +02:00
|
|
|
|
|
|
|
|
using System.Runtime.CompilerServices;
|
|
|
|
|
|
|
|
|
|
// This is a comparable strategy that may squeeze some extra time out of value types
|
|
|
|
|
|
|
|
|
|
public readonly struct ComparableStrategy<K> : IKeyStrategy<K> where K : IComparable<K>
|
|
|
|
|
{
|
|
|
|
|
public bool UsesPrefixes => false;
|
|
|
|
|
public bool UseBinarySearch => true;
|
|
|
|
|
|
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
|
|
public long GetPrefix(K key) => 0;
|
|
|
|
|
|
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
|
|
public int Compare(K x, K y) => x.CompareTo(y);
|
|
|
|
|
}
|