本文整理汇总了C#中Reko.Core.Machine.MachineOperand.Write方法的典型用法代码示例。如果您正苦于以下问题:C# MachineOperand.Write方法的具体用法?C# MachineOperand.Write怎么用?C# MachineOperand.Write使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Reko.Core.Machine.MachineOperand
的用法示例。
在下文中一共展示了MachineOperand.Write方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Write
public void Write(MachineOperand op, MachineInstructionWriter writer)
{
var imm = op as ImmediateOperand;
if (imm != null)
{
writer.Write("#");
int imm8 = imm.Value.ToInt32();
if (imm8 > 256 && ((imm8 & (imm8 - 1)) == 0))
{
/* only one bit set, and that later than bit 8.
* Represent as 1<<... .
*/
writer.Write("1<<");
{
uint n = 0;
while ((imm8 & 15) == 0)
{
n += 4; imm8 = imm8 >> 4;
}
// Now imm8 is 1, 2, 4 or 8.
n += (uint)((0x30002010 >> (int)(4 * (imm8 - 1))) & 15);
writer.Write(n);
}
}
else
{
var fmt = (-9 <= imm8 && imm8 <= 9) ? "{0}{1}" : "&{0}{1:X}";
var sign = "";
if (((int)imm8) < 0 && ((int)imm8) > -100)
{
imm8 = -imm8;
sign = "-";
}
writer.Write(fmt,sign,imm8);
}
return;
}
var adr = op as AddressOperand;
if (adr != null)
{
adr.Write(false, writer);
return;
}
var mem = op as ArmMemoryOperand;
if (mem != null)
{
mem.Write(false, writer);
return;
}
var sh = op as ShiftOperand;
if (sh != null)
{
sh.Write(false, writer);
return;
}
if (op == null)
writer.Write("<null>");
else
op.Write(false, writer);
}