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
|
|
|
|
|
|
2026-05-21 13:13:22 +02:00
|
|
|
public readonly struct ComparableStrategy<TK> : IKeyStrategy<TK> where TK : IComparable<TK>
|
2026-04-23 16:45:18 +02:00
|
|
|
{
|
|
|
|
|
public bool UsesPrefixes => false;
|
|
|
|
|
public bool UseBinarySearch => true;
|
|
|
|
|
|
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
2026-05-21 13:13:22 +02:00
|
|
|
public long GetPrefix(TK key) => 0;
|
2026-04-23 16:45:18 +02:00
|
|
|
|
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
2026-05-21 13:13:22 +02:00
|
|
|
public int Compare(TK x, TK y) => x.CompareTo(y);
|
2026-04-23 16:45:18 +02:00
|
|
|
}
|