了解IL汇编跳转语句

il代码,

cpp 复制代码
.assembly extern mscorlib {}
 
 .assembly Test
 {
     .ver 1:0:1:0
 }
 .module test.exe
  
 .method static void main() cil managed
 {
     .maxstack 5
     .entrypoint
     
     ldstr "Enter First Number"
     call void [mscorlib]System.Console::WriteLine (string)
     call  string [mscorlib]System.Console::ReadLine ()
     call int32 [mscorlib]System.Int32::Parse(string)

     ldstr "Enter Second Number"
     call void [mscorlib]System.Console::WriteLine (string)
     call  string [mscorlib]System.Console::ReadLine ()
     call int32 [mscorlib]System.Int32::Parse(string)

     ble smaller
     ldstr "Second Number is smaller than first."    
     call void [mscorlib]System.Console::WriteLine (string)

     br exit

smaller:
     ldstr "First number is smaller than second."    
     call void [mscorlib]System.Console::WriteLine (string)
exit:    
     ret
 }

提示输入数,获取输入数,转换输入数为整型;然后这句实现比较,

ble smaller,它告诉编译器去检查栈里面的第一数是否小于或等于第二个数,如果是小于,那么它将会跳转到"smaller"这个标签处;

构建运行如下;

还不是很了解IL汇编和其跳转语句,有时间继续;

相关推荐
github.com/starRTC3 小时前
Claude Code中英文系列教程34:再谈Skills
开发语言·c#·ai编程
bugcome_com5 小时前
C# 判断语句详解(if、switch、三目运算符、Null 条件运算符)
c#
霸王•吕布8 小时前
C#-使用OpenTK渲染3D模型
c#·opentk·glcontrol
游乐码8 小时前
c#封装成员变量和成员方法和访问修饰符
开发语言·c#
Never_Satisfied8 小时前
在c#中,Jint的AsString()和ToString()的区别
服务器·开发语言·c#
Never_Satisfied8 小时前
在c#中,获取文件的大小
java·开发语言·c#
weixin_468466858 小时前
PyTorch导出ONNX格式分割模型及在C#中调用预测
人工智能·pytorch·深度学习·c#·跨平台·onnx·语义分割
光泽雨17 小时前
C# 中 Assembly 类详解
开发语言·c#
少控科技17 小时前
C#基础训练营 - 02 - 运算器
开发语言·c#
两千次1 天前
图像的处理 图片裁剪工具方法 图片按比例缩放的工具方法
c#