mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-12 10:17:22 +01:00
Use Ordinal comparisons
This commit is contained in:
parent
47cfaf4da2
commit
6ebf550284
14 changed files with 19 additions and 20 deletions
|
|
@ -72,9 +72,9 @@ public readonly struct FullPath : IComparable, IEquatable< FullPath >
|
|||
=> obj switch
|
||||
{
|
||||
FullPath p => InternalName?.CompareTo( p.InternalName ) ?? -1,
|
||||
FileInfo f => string.Compare( FullName, f.FullName, StringComparison.InvariantCultureIgnoreCase ),
|
||||
FileInfo f => string.Compare( FullName, f.FullName, StringComparison.OrdinalIgnoreCase ),
|
||||
Utf8String u => InternalName?.CompareTo( u ) ?? -1,
|
||||
string s => string.Compare( FullName, s, StringComparison.InvariantCultureIgnoreCase ),
|
||||
string s => string.Compare( FullName, s, StringComparison.OrdinalIgnoreCase ),
|
||||
_ => -1,
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -38,14 +38,14 @@ public sealed unsafe partial class Utf8String : IDisposable
|
|||
// Can throw ArgumentOutOfRange if length is higher than max length.
|
||||
// The Crc32 will be computed.
|
||||
public static Utf8String FromByteStringUnsafe( byte* path, int length, bool isNullTerminated, bool? isLower = null, bool? isAscii = false )
|
||||
=> FromSpanUnsafe( new ReadOnlySpan< byte >( path, length ), isNullTerminated, isLower, isAscii );
|
||||
=> new Utf8String().Setup( path, length, null, isNullTerminated, false, isLower, isAscii );
|
||||
|
||||
// Same as above, just with a span.
|
||||
public static Utf8String FromSpanUnsafe( ReadOnlySpan< byte > path, bool isNullTerminated, bool? isLower = null, bool? isAscii = false )
|
||||
{
|
||||
fixed( byte* ptr = path )
|
||||
{
|
||||
return new Utf8String().Setup( ptr, path.Length, null, isNullTerminated, false, isLower, isAscii );
|
||||
return FromByteStringUnsafe( ptr, path.Length, isNullTerminated, isLower, isAscii );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -70,8 +70,8 @@ public readonly struct GamePath : IComparable
|
|||
{
|
||||
return rhs switch
|
||||
{
|
||||
string path => string.Compare( _path, path, StringComparison.InvariantCulture ),
|
||||
GamePath path => string.Compare( _path, path._path, StringComparison.InvariantCulture ),
|
||||
string path => string.Compare( _path, path, StringComparison.Ordinal ),
|
||||
GamePath path => string.Compare( _path, path._path, StringComparison.Ordinal ),
|
||||
_ => -1,
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue