This commit was manufactured by cvs2svn to create branch 'mono-1-0'.
[mono.git] / mcs / ilasm / codegen / LdcInstr.cs
1 //
2 // Mono.ILASM.LdcInstr
3 //
4 // Author(s):
5 //  Jackson Harper (Jackson@LatitudeGeo.com)
6 //
7 // (C) 2003 Jackson Harper, All rights reserved
8 //
9
10
11 using System;
12
13 namespace Mono.ILASM {
14
15         public class LdcInstr : IInstr {
16
17                 private MiscInstr op;
18                 private double d_operand;
19                 private long l_operand;
20
21                 public LdcInstr (MiscInstr op, double operand)
22                 {
23                         this.op = op;
24                         d_operand = operand;
25                 }
26
27                 public LdcInstr (MiscInstr op, long operand)
28                 {
29                         this.op = op;
30                         l_operand = operand;
31                 }
32
33                 public void Emit (CodeGen code_gen, MethodDef meth,
34                                   PEAPI.CILInstructions cil)
35                 {
36                         switch (op) {
37                         case MiscInstr.ldc_r8:
38                                 cil.ldc_r8 (d_operand);
39                                 break;
40                         case MiscInstr.ldc_r4:
41                                 cil.ldc_r4 ((float) d_operand);
42                                 break;
43                         case MiscInstr.ldc_i8:
44                                 cil.ldc_i8 (l_operand);
45                                 break;
46                         }
47                 }
48
49         }
50
51 }
52