Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试找出一些 CIL 代码。但似乎这两个陈述做同样的事情(根据我读过的一切)。
ldc.i4 33
和
ldc.i4.33
两者都被认为“将 int32 加载到值为 33 的堆栈上”。
它是否正确?为什么?我原以为这ldc.i4.33将是“将一个整数从局部变量索引 33 加载到堆栈上”。
我在哪里错了?
操作码ldc.i4.33不存在。
有一些特殊的(称为宏)操作码,来自:
ldc.i4.m1 // has the same effect as: ldc.i4 -1
到
ldc.i4.8 // has the same effect as: ldc.i4 8
但对于常见情况,它们只是ldc.i4操作码的一种简短形式,用于优化 CIL 大小。
ldc.i4
类似地,ldloc.0是一个简短的形式(即具有更紧凑的 CIL 编码,但做的完全一样)ldloc 0等。
ldloc.0
ldloc 0