Constant loading



      ldc_i4      ldc_i4_<n>      ldc_i4_s      ldc_i8
      ldc_r4      ldc_r8      ldnull      ldstr


 ldc_i4 
  ·  OperationLoad int32 constant onto the stack
  ·  Format
ldc_i4
n[4]
  ·  Direct Format
{ldc_i4}
n
  ·  Forms ldc_i4 = 157 (0x9D)
  ·  Stack... => ..., value
   · Description The 32-bit value n is pushed onto the stack as type int32.
   · Notes This instruction can also be used to load constants of type uint32 onto the stack.


 ldc_i4_<n> 
  ·  OperationLoad n onto the stack
  ·  Format
ldc_i4_<n>
  ·  Direct Format
{ldc_i4_<n>}
  ·  Forms ldc_i4_m1 = 146 (0x92)
ldc_i4_0 = 147 (0x93)
ldc_i4_1 = 148 (0x94)
ldc_i4_2 = 149 (0x95)
ldc_i4_3 = 150 (0x96)
ldc_i4_4 = 151 (0x97)
ldc_i4_5 = 152 (0x98)
ldc_i4_6 = 153 (0x99)
ldc_i4_7 = 154 (0x9A)
ldc_i4_8 = 155 (0x9B)
  ·  Stack... => ..., value
   · Description The value n is pushed onto the stack as type int32.
   · Notes These instructions can also be used to load constants of type uint32 onto the stack.


 ldc_i4_s 
  ·  OperationLoad small int32 constant onto the stack
  ·  Format
ldc_i4_s
n
  ·  Direct Format
{ldc_i4_s}
n
  ·  Forms ldc_i4_s = 156 (0x9C)
  ·  Stack... => ..., value
   · Description The signed 8-bit value n is pushed onto the stack as type int32.
   · Notes This instruction can also be used to load constants of type uint32 onto the stack.


 ldc_i8 
  ·  OperationLoad int64 constant onto the stack
  ·  Format
ldc_i8
n[8]
  ·  Direct Format
{ldc_i8}
n[8]
  ·  Forms ldc_i8 = 158 (0x9E)
  ·  Stack... => ..., value
   · Description The 64-bit value n is pushed onto the stack as type int64.
   · Notes This instruction can also be used to load constants of type uint64 onto the stack.


 ldc_r4 
  ·  OperationLoad 32-bit floating point constant onto the stack
  ·  Format
ldc_r4
n[4]
  ·  Direct Format
{ldc_r4}
n[4]
  ·  Forms ldc_r4 = 159 (0x9F)
  ·  Stack... => ..., value
   · Description The 32-bit floating point value n is fetched, converted to native float, and then pushed onto the stack as value.


 ldc_r8 
  ·  OperationLoad 64-bit floating point constant onto the stack
  ·  Format
ldc_r8
n[8]
  ·  Direct Format
{ldc_r8}
n[8]
  ·  Forms ldc_r8 = 160 (0xA0)
  ·  Stack... => ..., value
   · Description The 64-bit floating point value n is fetched, converted to native float, and then pushed onto the stack as value.


 ldnull 
  ·  OperationLoad null onto the stack
  ·  Format
ldnull
  ·  Direct Format
{ldnull}
  ·  Forms ldnull = 145 (0x91)
  ·  Stack... => ..., value
   · Description The value null is pushed onto the stack as type ptr.
   · Notes This instruction must not be confused with ldc_i4_0. Values of type int32 and ptr do not necessarily occupy the same amount of space in a stack word on all platforms.


 ldstr 
  ·  OperationLoad a string constant onto the stack
  ·  Format
ldstr
token[4]
  ·  Direct Format
{ldstr}
token
  ·  Forms ldstr = 233 (0xE9)
  ·  Stack... => ..., string
   · Description Loads the string token from the current method's image and pushes the corresponding string object onto the stack.
   · Exceptions System.OutOfMemoryException -- Raised if there is insufficient memory to allocate the string.


Copyright © Southern Storm Software Pty Ltd 2002
Licensed under GNU FDL