本文整理汇总了C#中Opcode.Numsz方法的典型用法代码示例。如果您正苦于以下问题:C# Opcode.Numsz方法的具体用法?C# Opcode.Numsz怎么用?C# Opcode.Numsz使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Opcode
的用法示例。
在下文中一共展示了Opcode.Numsz方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Literal
}//Nibble
/// <summary>
/// rewrite literal from parsed value buffer/stack to code buffer
/// </summary>
protected override void Literal( Opcode op, int top, int start )
{
if( op == Opcode.Ident )
{
Copy( op, true, top, start );
return;
}
if( (op < Opcode.Ident) || (op == Opcode.Exception) )
{
Write( unchecked((byte)op) );
return;
}
var len = top - start;
if( (op.Kind() <= Opkind.Number) && (unchecked((byte)op) >= unchecked((byte)Opcode.Char)) )
{
Debug.Assert( op <= Opcode.Double );
Debug.Assert( len == op.Numsz() );
Need( len + 1 );
Code[CodeAt++] = unchecked((byte)op);
Array.Copy( Vals, start, Code, CodeAt, len );
CodeAt += len;
return;
}
Debug.Assert( op == Opcode.String );
if( len < (1 << 7) )
{
Copy( op, true, top, start );
return;
}
if( len < (1 << 14) )
{
Need( 3 + len );
Code[CodeAt++] = unchecked((byte)op);
Code[CodeAt++] = unchecked((byte)(0x80 | len));
Code[CodeAt++] = unchecked((byte)(len >> 7));
Array.Copy( Vals, start, Code, CodeAt, len );
CodeAt += len;
return;
}
if( len < (1 << 21) )
{
Need( 4 + len );
Code[CodeAt++] = unchecked((byte)op);
Code[CodeAt++] = unchecked((byte)(0x80 | len));
Code[CodeAt++] = unchecked((byte)(0x80 | (len >> 7)));
Code[CodeAt++] = unchecked((byte)(len >> 14));
Array.Copy( Vals, start, Code, CodeAt, len );
CodeAt += len;
return;
}
if( len < (1 << 28) )
{
Need( 5 + len );
Code[CodeAt++] = unchecked((byte)op);
Code[CodeAt++] = unchecked((byte)(0x80 | len));
Code[CodeAt++] = unchecked((byte)(0x80 | (len >> 7)));
Code[CodeAt++] = unchecked((byte)(0x80 | (len >> 14)));
Code[CodeAt++] = unchecked((byte)(len >> 21));
Array.Copy( Vals, start, Code, CodeAt, len );
CodeAt += len;
return;
}
throw new InvalidOperationException();
}//Literal