OpCodes.Ldind_U2 字段
定义
将 unsigned int16 类型的值作为 int32 间接加载到计算堆栈上。Loads a value of type unsigned int16 as an int32 onto the evaluation stack indirectly.
public: static initonly System::Reflection::Emit::OpCode Ldind_U2;
public static readonly System.Reflection.Emit.OpCode Ldind_U2;
staticval mutable Ldind_U2 : System.Reflection.Emit.OpCode
Public Shared ReadOnly Ldind_U2 As OpCode
字段值
注解
下表列出了指令的十六进制和 Microsoft 中间语言 (MSIL) 程序集格式,以及简短的参考摘要:The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary:
| 格式Format | 程序集格式Assembly Format | 说明Description |
|---|---|---|
| 4949 | ldindldind.u2 | 将 unsigned int16 地址处的值 addr 作为加载到堆栈上 int32 。Loads the unsigned int16 value at address addr onto the stack as an int32. |
堆栈转换行为顺序如下:The stack transitional behavior, in sequential order, is:
地址被推送到堆栈上。An address is pushed onto the stack.
从堆栈中弹出该地址;获取位于地址的值。The address is popped from the stack; the value located at the address is fetched.
提取的值被推送到堆栈上。The fetched value is pushed onto the stack.
ldind.u2指令间接将 unsigned int16 值从类型为、或 * ) 的指定地址 (加载 native int & 到堆栈上 int32 。The ldind.u2 instruction indirectly loads an unsigned int16 value from the specified address (of type native int, &, or *) onto the stack as an int32.
所有 ldind 说明都是 Ldobj 指定相应内置值类的指令的快捷方式。All of the ldind instructions are shortcuts for a Ldobj instruction that specifies the corresponding built-in value class.
请注意,小于4个字节的整数值将扩展到在将 int32 native int 其加载到计算堆栈上时不) (。Note that integer values of less than 4 bytes are extended to int32 (not native int) when they are loaded onto the evaluation stack. 将浮点值 F 加载到计算堆栈上时,会将其转换为类型。Floating-point values are converted to F type when loaded onto the evaluation stack.
格式正确的 Microsoft 中间语言 (MSIL) 确保 ldind 以与指针类型一致的方式使用指令。Correctly-formed Microsoft Intermediate Language (MSIL) ensures that the ldind instructions are used in a manner consistent with the type of the pointer.
最初推送到堆栈上的地址必须与计算机上对象的自然大小对齐,否则 NullReferenceException 可能会发生 (参阅 Unaligned) 的预防措施的前缀指令。The address initially pushed onto the stack must be aligned to the natural size of objects on the machine or a NullReferenceException can occur (see the Unaligned prefix instruction for preventative measures). 例如,和) (返回地址的所有 MSIL 指令的结果 Ldloca Ldarga 都安全对齐。The results of all MSIL instructions that return addresses (for example, Ldloca and Ldarga) are safely aligned. 对于大于1个字节的数据类型,字节排序依赖于目标 CPU。For datatypes larger than 1 byte, the byte ordering is dependent on the target CPU. 依赖于字节排序的代码可能无法在所有平台上运行。Code that depends on byte ordering might not run on all platforms.
NullReferenceException 如果检测到无效地址,则可能会引发。NullReferenceException can be thrown if an invalid address is detected.
以下 Emit 方法重载可以使用 ldind.u2 操作码:The following Emit method overload can use the ldind.u2 opcode: