goto Finish;
}
- [MethodImpl(MethodImplOptions.AggressiveOptimization)]
private static unsafe nuint GetIndexOfFirstNonAsciiByte_Sse2(byte* pBuffer, nuint bufferLength)
{
// JIT turns the below into constants
goto Finish;
}
- [MethodImpl(MethodImplOptions.AggressiveOptimization)]
private static unsafe nuint GetIndexOfFirstNonAsciiChar_Sse2(char* pBuffer, nuint bufferLength /* in chars */)
{
// This method contains logic optimized for both SSE2 and SSE41. Much of the logic in this method
/// narrows each WORD to a BYTE, then writes the 4-byte result to the output buffer
/// also in machine-endian order.
/// </summary>
- [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
private static void NarrowFourUtf16CharsToAsciiAndWriteToBuffer(ref byte outputBuffer, ulong value)
{
Debug.Assert(AllCharsInUInt64AreAscii(value));
/// narrows each WORD to a BYTE, then writes the 2-byte result to the output buffer also in
/// machine-endian order.
/// </summary>
- [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
private static void NarrowTwoUtf16CharsToAsciiAndWriteToBuffer(ref byte outputBuffer, uint value)
{
Debug.Assert(AllCharsInUInt32AreAscii(value));
/// or once <paramref name="elementCount"/> elements have been converted. Returns the total number
/// of elements that were able to be converted.
/// </summary>
- [MethodImpl(MethodImplOptions.AggressiveOptimization)]
public static unsafe nuint NarrowUtf16ToAscii(char* pUtf16Buffer, byte* pAsciiBuffer, nuint elementCount)
{
nuint currentOffset = 0;
goto Finish;
}
- [MethodImpl(MethodImplOptions.AggressiveOptimization)]
private static unsafe nuint NarrowUtf16ToAscii_Sse2(char* pUtf16Buffer, byte* pAsciiBuffer, nuint elementCount)
{
// This method contains logic optimized for both SSE2 and SSE41. Much of the logic in this method
goto Finish;
}
- [MethodImpl(MethodImplOptions.AggressiveOptimization)]
private static unsafe nuint WidenAsciiToUtf16_Sse2(byte* pAsciiBuffer, char* pUtf16Buffer, nuint elementCount)
{
// JIT turns the below into constants
/// Given a DWORD which represents a buffer of 4 bytes, widens the buffer into 4 WORDs and
/// writes them to the output buffer with machine endianness.
/// </summary>
- [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
private static void WidenFourAsciiBytesToUtf16AndWriteToBuffer(ref char outputBuffer, uint value)
{
Debug.Assert(AllBytesInUInt32AreAscii(value));
/// Given a machine-endian DWORD which four bytes of UTF-8 data, interprets the input as a
/// four-byte UTF-8 sequence and returns the machine-endian DWORD of the UTF-16 representation.
/// </summary>
- [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
private static uint ExtractCharsFromFourByteSequence(uint value)
{
if (BitConverter.IsLittleEndian)
/// Given a DWORD which represents a buffer of 4 ASCII bytes, widen each byte to a 16-bit WORD
/// and writes the resulting QWORD into the destination with machine endianness.
/// </summary>
- [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
private static void Widen4AsciiBytesToCharsAndWrite(ref char outputBuffer, uint value)
{
if (Bmi2.X64.IsSupported)
// On method return, pInputBufferRemaining and pOutputBufferRemaining will both point to where
// the next byte would have been consumed from / the next char would have been written to.
// inputLength in bytes, outputCharsRemaining in chars.
- [MethodImpl(MethodImplOptions.AggressiveOptimization)]
public static OperationStatus TranscodeToUtf16(byte* pInputBuffer, int inputLength, char* pOutputBuffer, int outputCharsRemaining, out byte* pInputBufferRemaining, out char* pOutputBufferRemaining)
{
Debug.Assert(inputLength >= 0, "Input length must not be negative.");