1
0
mirror of https://github.com/oliverbooth/X10D synced 2024-11-10 02:05:43 +00:00

Compare commits

..

1 Commits

Author SHA1 Message Date
Oliver Booth
6ea1a99a1c
Merge b843d155f6 into 5ff7b68b37 2023-08-26 17:40:31 +00:00
3 changed files with 2 additions and 11 deletions

View File

@ -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

View File

@ -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]);

View File

@ -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>