* Mono.Posix.dll.sources: Rename Mono.Posix to Mono.Unix.
[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, Location loc)
22                         : base (loc)
23                 {
24                         this.op = op;
25                         d_operand = operand;
26                 }
27
28                 public LdcInstr (MiscInstr op, long operand, Location loc)
29                         : base (loc)
30                 {
31                         this.op = op;
32                         l_operand = operand;
33                 }
34
35                 public override void Emit (CodeGen code_gen, MethodDef meth,
36                                            PEAPI.CILInstructions cil)
37                 {
38                         switch (op) {
39                         case MiscInstr.ldc_r8:
40                                 cil.ldc_r8 (d_operand);
41                                 break;
42                         case MiscInstr.ldc_r4:
43                                 cil.ldc_r4 ((float) d_operand);
44                                 break;
45                         case MiscInstr.ldc_i8:
46                                 cil.ldc_i8 (l_operand);
47                                 break;
48                         }
49                 }
50
51         }
52
53 }
54