Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ InternalGetSignatureArray()

byte[] System.Reflection.Emit.SignatureHelper.InternalGetSignatureArray ( )
inlinepackage

Definition at line 560 of file SignatureHelper.cs.

561 {
562 int argCount = m_argCount;
563 int currSig = m_currSig;
564 int num = currSig;
565 num = ((argCount < 127) ? (num + 1) : ((argCount >= 16383) ? (num + 4) : (num + 2)));
566 byte[] array = new byte[num];
567 int dstOffset = 0;
568 array[dstOffset++] = m_signature[0];
569 if (argCount <= 127)
570 {
571 array[dstOffset++] = (byte)((uint)argCount & 0xFFu);
572 }
573 else if (argCount <= 16383)
574 {
575 array[dstOffset++] = (byte)((uint)(argCount >> 8) | 0x80u);
576 array[dstOffset++] = (byte)((uint)argCount & 0xFFu);
577 }
578 else
579 {
580 if (argCount > 536870911)
581 {
582 throw new ArgumentException(SR.Argument_LargeInteger);
583 }
584 array[dstOffset++] = (byte)((uint)(argCount >> 24) | 0xC0u);
585 array[dstOffset++] = (byte)((uint)(argCount >> 16) & 0xFFu);
586 array[dstOffset++] = (byte)((uint)(argCount >> 8) & 0xFFu);
587 array[dstOffset++] = (byte)((uint)argCount & 0xFFu);
588 }
589 Buffer.BlockCopy(m_signature, 2, array, dstOffset, currSig - 2);
590 array[num - 1] = 0;
591 return array;
592 }

References System.SR.Argument_LargeInteger, System.array, System.Buffer.BlockCopy(), System.Reflection.Emit.SignatureHelper.m_argCount, System.Reflection.Emit.SignatureHelper.m_currSig, and System.Reflection.Emit.SignatureHelper.m_signature.

Referenced by System.Reflection.Emit.DynamicResolver.DynamicResolver().