diff --git a/X10D/src/Collections/ByteExtensions.cs b/X10D/src/Collections/ByteExtensions.cs
index 1fa4ca9..5207b26 100644
--- a/X10D/src/Collections/ByteExtensions.cs
+++ b/X10D/src/Collections/ByteExtensions.cs
@@ -20,7 +20,7 @@ public static class ByteExtensions
/// The value to unpack.
/// An array of with length 8.
[Pure]
- [MethodImpl(CompilerResources.MethodImplOptions)]
+ [MethodImpl(CompilerResources.MaxOptimization)]
public static bool[] Unpack(this byte value)
{
var buffer = new bool[Size];
@@ -35,7 +35,7 @@ public static class ByteExtensions
/// When this method returns, contains the unpacked booleans from .
/// is not large enough to contain the result.
[ExcludeFromCodeCoverage]
- [MethodImpl(CompilerResources.MethodImplOptions)]
+ [MethodImpl(CompilerResources.MaxOptimization)]
public static void Unpack(this byte value, Span destination)
{
if (destination.Length < Size)
@@ -52,7 +52,7 @@ public static class ByteExtensions
UnpackInternal_Fallback(value, destination);
}
- [MethodImpl(CompilerResources.MethodImplOptions)]
+ [MethodImpl(CompilerResources.MaxOptimization)]
internal static void UnpackInternal_Fallback(this byte value, Span destination)
{
for (var index = 0; index < Size; index++)
@@ -61,7 +61,7 @@ public static class ByteExtensions
}
}
- [MethodImpl(CompilerResources.MethodImplOptions)]
+ [MethodImpl(CompilerResources.MaxOptimization)]
internal unsafe static void UnpackInternal_Ssse3(this byte value, Span destination)
{
fixed (bool* pDestination = destination)
diff --git a/X10D/src/Collections/Int16Extensions.cs b/X10D/src/Collections/Int16Extensions.cs
index 63948ab..fb722b9 100644
--- a/X10D/src/Collections/Int16Extensions.cs
+++ b/X10D/src/Collections/Int16Extensions.cs
@@ -20,7 +20,7 @@ public static class Int16Extensions
/// The value to unpack.
/// An array of with length 16.
[Pure]
- [MethodImpl(CompilerResources.MethodImplOptions)]
+ [MethodImpl(CompilerResources.MaxOptimization)]
public static bool[] Unpack(this short value)
{
var ret = new bool[Size];
@@ -35,7 +35,7 @@ public static class Int16Extensions
/// When this method returns, contains the unpacked booleans from .
/// is not large enough to contain the result.
[ExcludeFromCodeCoverage]
- [MethodImpl(CompilerResources.MethodImplOptions)]
+ [MethodImpl(CompilerResources.MaxOptimization)]
public static void Unpack(this short value, Span destination)
{
if (destination.Length < Size)
@@ -52,7 +52,7 @@ public static class Int16Extensions
UnpackInternal_Fallback(value, destination);
}
- [MethodImpl(CompilerResources.MethodImplOptions)]
+ [MethodImpl(CompilerResources.MaxOptimization)]
internal static void UnpackInternal_Fallback(this short value, Span destination)
{
for (var index = 0; index < Size; index++)
@@ -61,7 +61,7 @@ public static class Int16Extensions
}
}
- [MethodImpl(CompilerResources.MethodImplOptions)]
+ [MethodImpl(CompilerResources.MaxOptimization)]
internal unsafe static void UnpackInternal_Ssse3(this short value, Span destination)
{
fixed (bool* pDestination = destination)
diff --git a/X10D/src/Collections/Int32Extensions.cs b/X10D/src/Collections/Int32Extensions.cs
index c8ab5a0..19dbe7e 100644
--- a/X10D/src/Collections/Int32Extensions.cs
+++ b/X10D/src/Collections/Int32Extensions.cs
@@ -20,7 +20,7 @@ public static class Int32Extensions
/// The value to unpack.
/// An array of with length 32.
[Pure]
- [MethodImpl(CompilerResources.MethodImplOptions)]
+ [MethodImpl(CompilerResources.MaxOptimization)]
public static bool[] Unpack(this int value)
{
var ret = new bool[Size];
@@ -35,7 +35,7 @@ public static class Int32Extensions
/// When this method returns, contains the unpacked booleans from .
/// is not large enough to contain the result.
[ExcludeFromCodeCoverage]
- [MethodImpl(CompilerResources.MethodImplOptions)]
+ [MethodImpl(CompilerResources.MaxOptimization)]
public static void Unpack(this int value, Span destination)
{
if (destination.Length < Size)
@@ -58,7 +58,7 @@ public static class Int32Extensions
UnpackInternal_Fallback(value, destination);
}
- [MethodImpl(CompilerResources.MethodImplOptions)]
+ [MethodImpl(CompilerResources.MaxOptimization)]
internal static void UnpackInternal_Fallback(this int value, Span destination)
{
for (var index = 0; index < Size; index++)
@@ -67,7 +67,7 @@ public static class Int32Extensions
}
}
- [MethodImpl(CompilerResources.MethodImplOptions)]
+ [MethodImpl(CompilerResources.MaxOptimization)]
internal static unsafe void UnpackInternal_Ssse3(this int value, Span destination)
{
fixed (bool* pDestination = destination)
diff --git a/X10D/src/CompilerServices/CompilerResources.cs b/X10D/src/CompilerServices/CompilerResources.cs
index 3c68446..373a366 100644
--- a/X10D/src/CompilerServices/CompilerResources.cs
+++ b/X10D/src/CompilerServices/CompilerResources.cs
@@ -4,6 +4,6 @@ namespace X10D.CompilerServices;
internal static class CompilerResources
{
- public const MethodImplOptions MethodImplOptions = System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining |
- System.Runtime.CompilerServices.MethodImplOptions.AggressiveOptimization;
+ public const MethodImplOptions MaxOptimization = MethodImplOptions.AggressiveInlining |
+ MethodImplOptions.AggressiveOptimization;
}
diff --git a/X10D/src/Core/SpanExtensions.cs b/X10D/src/Core/SpanExtensions.cs
index 239c7a5..c1f2a1e 100644
--- a/X10D/src/Core/SpanExtensions.cs
+++ b/X10D/src/Core/SpanExtensions.cs
@@ -43,7 +43,7 @@ public static class SpanExtensions
///
/// The size of is unsupported.
[Pure]
- [MethodImpl(CompilerResources.MethodImplOptions)]
+ [MethodImpl(CompilerResources.MaxOptimization)]
public static bool Contains(this Span span, T value) where T : struct, Enum
{
return Contains((ReadOnlySpan)span, value);
@@ -62,7 +62,7 @@ public static class SpanExtensions
///
/// The size of is unsupported.
[Pure]
- [MethodImpl(CompilerResources.MethodImplOptions)]
+ [MethodImpl(CompilerResources.MaxOptimization)]
public static bool Contains(this ReadOnlySpan span, T value) where T : struct, Enum
{
switch (Unsafe.SizeOf())
@@ -111,7 +111,7 @@ public static class SpanExtensions
/// An 8-bit unsigned integer containing the packed booleans.
/// contains more than 8 elements.
[Pure]
- [MethodImpl(CompilerResources.MethodImplOptions)]
+ [MethodImpl(CompilerResources.MaxOptimization)]
public static byte PackByte(this Span source)
{
return PackByte((ReadOnlySpan)source);
@@ -124,7 +124,7 @@ public static class SpanExtensions
/// An 8-bit unsigned integer containing the packed booleans.
/// contains more than 8 elements.
[Pure]
- [MethodImpl(CompilerResources.MethodImplOptions)]
+ [MethodImpl(CompilerResources.MaxOptimization)]
[ExcludeFromCodeCoverage]
public static byte PackByte(this ReadOnlySpan source)
{
@@ -171,7 +171,7 @@ public static class SpanExtensions
/// A 16-bit signed integer containing the packed booleans.
/// contains more than 16 elements.
[Pure]
- [MethodImpl(CompilerResources.MethodImplOptions)]
+ [MethodImpl(CompilerResources.MaxOptimization)]
[ExcludeFromCodeCoverage]
public static short PackInt16(this ReadOnlySpan source)
{
@@ -208,7 +208,7 @@ public static class SpanExtensions
/// A 32-bit signed integer containing the packed booleans.
/// contains more than 32 elements.
[Pure]
- [MethodImpl(CompilerResources.MethodImplOptions)]
+ [MethodImpl(CompilerResources.MaxOptimization)]
public static int PackInt32(this Span source)
{
return PackInt32((ReadOnlySpan)source);
@@ -221,7 +221,7 @@ public static class SpanExtensions
/// A 32-bit signed integer containing the packed booleans.
/// contains more than 32 elements.
[Pure]
- [MethodImpl(CompilerResources.MethodImplOptions)]
+ [MethodImpl(CompilerResources.MaxOptimization)]
[ExcludeFromCodeCoverage]
public static int PackInt32(this ReadOnlySpan source)
{
@@ -266,7 +266,7 @@ public static class SpanExtensions
/// A 64-bit signed integer containing the packed booleans.
/// contains more than 64 elements.
[Pure]
- [MethodImpl(CompilerResources.MethodImplOptions)]
+ [MethodImpl(CompilerResources.MaxOptimization)]
public static long PackInt64(this Span source)
{
return PackInt64((ReadOnlySpan)source);
@@ -279,7 +279,7 @@ public static class SpanExtensions
/// A 64-bit signed integer containing the packed booleans.
/// contains more than 64 elements.
[Pure]
- [MethodImpl(CompilerResources.MethodImplOptions)]
+ [MethodImpl(CompilerResources.MaxOptimization)]
public static long PackInt64(this ReadOnlySpan source)
{
switch (source.Length)
@@ -304,7 +304,7 @@ public static class SpanExtensions
}
[Pure]
- [MethodImpl(CompilerResources.MethodImplOptions)]
+ [MethodImpl(CompilerResources.MaxOptimization)]
internal static byte PackByteInternal_Fallback(this ReadOnlySpan source)
{
byte result = 0;
@@ -318,7 +318,7 @@ public static class SpanExtensions
}
[Pure]
- [MethodImpl(CompilerResources.MethodImplOptions)]
+ [MethodImpl(CompilerResources.MaxOptimization)]
internal static short PackInt16Internal_Fallback(this ReadOnlySpan source)
{
short result = 0;
@@ -332,7 +332,7 @@ public static class SpanExtensions
}
[Pure]
- [MethodImpl(CompilerResources.MethodImplOptions)]
+ [MethodImpl(CompilerResources.MaxOptimization)]
internal static int PackInt32Internal_Fallback(this ReadOnlySpan source)
{
var result = 0;
@@ -346,7 +346,7 @@ public static class SpanExtensions
}
[Pure]
- [MethodImpl(CompilerResources.MethodImplOptions)]
+ [MethodImpl(CompilerResources.MaxOptimization)]
internal static byte PackByteInternal_Sse2(this ReadOnlySpan source)
{
unsafe
@@ -360,7 +360,7 @@ public static class SpanExtensions
}
[Pure]
- [MethodImpl(CompilerResources.MethodImplOptions)]
+ [MethodImpl(CompilerResources.MaxOptimization)]
internal static short PackInt16Internal_Sse2(this ReadOnlySpan source)
{
unsafe
@@ -378,7 +378,7 @@ public static class SpanExtensions
}
[Pure]
- [MethodImpl(CompilerResources.MethodImplOptions)]
+ [MethodImpl(CompilerResources.MaxOptimization)]
internal static int PackInt32Internal_Avx2(this ReadOnlySpan source)
{
unsafe
@@ -403,7 +403,7 @@ public static class SpanExtensions
}
[Pure]
- [MethodImpl(CompilerResources.MethodImplOptions)]
+ [MethodImpl(CompilerResources.MaxOptimization)]
internal static int PackInt32Internal_Sse2(this ReadOnlySpan source)
{
unsafe
diff --git a/X10D/src/Text/CharExtensions.cs b/X10D/src/Text/CharExtensions.cs
index 44efb04..8b015de 100644
--- a/X10D/src/Text/CharExtensions.cs
+++ b/X10D/src/Text/CharExtensions.cs
@@ -54,7 +54,7 @@ public static class CharExtensions
/// The character to repeat.
/// The number of times to repeat.
/// The span of characters into which the repeated characters will be written.
- [MethodImpl(CompilerResources.MethodImplOptions)]
+ [MethodImpl(CompilerResources.MaxOptimization)]
public static void Repeat(this char value, int count, Span destination)
{
if (count < 0)
diff --git a/X10D/src/Text/CharSpanExtensions.cs b/X10D/src/Text/CharSpanExtensions.cs
index f9ba1d7..17bfb71 100644
--- a/X10D/src/Text/CharSpanExtensions.cs
+++ b/X10D/src/Text/CharSpanExtensions.cs
@@ -82,7 +82,7 @@ public static class CharSpanExtensions
/// is .
/// is less than 0.
[Pure]
- [MethodImpl(CompilerResources.MethodImplOptions)]
+ [MethodImpl(CompilerResources.MaxOptimization)]
public static string Repeat(this ReadOnlySpan value, int count)
{
switch (count)
@@ -117,7 +117,7 @@ public static class CharSpanExtensions
///
/// is too short to contain the repeated string.
///
- [MethodImpl(CompilerResources.MethodImplOptions)]
+ [MethodImpl(CompilerResources.MaxOptimization)]
public static void Repeat(this ReadOnlySpan value, int count, Span destination)
{
if (count < 0)
diff --git a/X10D/src/Text/StringExtensions.cs b/X10D/src/Text/StringExtensions.cs
index 6aef82b..7b0f048 100644
--- a/X10D/src/Text/StringExtensions.cs
+++ b/X10D/src/Text/StringExtensions.cs
@@ -894,7 +894,7 @@ public static class StringExtensions
///
/// is too short to contain the repeated string.
///
- [MethodImpl(CompilerResources.MethodImplOptions)]
+ [MethodImpl(CompilerResources.MaxOptimization)]
public static void Repeat(this string value, int count, Span destination)
{
if (value is null)