mirror of
https://github.com/oliverbooth/X10D
synced 2024-11-14 16:15:41 +00:00
Compare commits
No commits in common. "bd823ba8182b3409048c98d3e394ac913a853027" and "b843d155f69753e97176d011c8108da4aaa4cacd" have entirely different histories.
bd823ba818
...
b843d155f6
@ -38,7 +38,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
BigEndian/LittleEndian methods.
|
||||
- X10D: `Stream.GetHash<>` and `Stream.TryWriteHash<>` now throw ArgumentException in lieu of
|
||||
TypeInitializationException.
|
||||
- X10D: `char.IsEmoji` no longer allocates for .NET 7.
|
||||
|
||||
### Removed
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
using System.Diagnostics;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
@ -94,7 +93,7 @@ public static class DecimalExtensions
|
||||
private static void GetBits(decimal value, Span<int> destination)
|
||||
{
|
||||
#if NET5_0_OR_GREATER
|
||||
_ = decimal.GetBits(value, destination);
|
||||
decimal.GetBits(value, destination);
|
||||
#else
|
||||
Span<byte> buffer = stackalloc byte[16];
|
||||
MemoryMarshal.Write(buffer, ref value);
|
||||
@ -102,7 +101,6 @@ public static class DecimalExtensions
|
||||
#endif
|
||||
}
|
||||
|
||||
[Conditional("NET5_0_OR_GREATER")]
|
||||
private static void WriteBits(Span<int> destination, Span<byte> buffer)
|
||||
{
|
||||
var flags = MemoryMarshal.Read<int>(buffer[..4]);
|
||||
|
@ -18,13 +18,7 @@ public static class CharExtensions
|
||||
[MethodImpl(CompilerResources.MethodImplOptions)]
|
||||
public static bool IsEmoji(this char value)
|
||||
{
|
||||
#if NET7_0_OR_GREATER
|
||||
Span<char> chars = stackalloc char[1];
|
||||
chars[0] = value;
|
||||
return EmojiRegex.Value.IsMatch(chars);
|
||||
#else
|
||||
return EmojiRegex.Value.IsMatch(value.ToString());
|
||||
#endif
|
||||
return value.ToString().IsEmoji();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
Loading…
Reference in New Issue
Block a user