Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
DecrementInstruction.cs
Go to the documentation of this file.
2
4
5internal abstract class DecrementInstruction : Instruction
6{
7 private sealed class DecrementInt16 : DecrementInstruction
8 {
9 public override int Run(InterpretedFrame frame)
10 {
11 object obj = frame.Pop();
12 if (obj == null)
13 {
14 frame.Push(null);
15 }
16 else
17 {
18 frame.Push((short)((short)obj - 1));
19 }
20 return 1;
21 }
22 }
23
24 private sealed class DecrementInt32 : DecrementInstruction
25 {
26 public override int Run(InterpretedFrame frame)
27 {
28 object obj = frame.Pop();
29 if (obj == null)
30 {
31 frame.Push(null);
32 }
33 else
34 {
35 frame.Push((int)obj - 1);
36 }
37 return 1;
38 }
39 }
40
41 private sealed class DecrementInt64 : DecrementInstruction
42 {
43 public override int Run(InterpretedFrame frame)
44 {
45 object obj = frame.Pop();
46 if (obj == null)
47 {
48 frame.Push(null);
49 }
50 else
51 {
52 frame.Push((long)obj - 1);
53 }
54 return 1;
55 }
56 }
57
59 {
60 public override int Run(InterpretedFrame frame)
61 {
62 object obj = frame.Pop();
63 if (obj == null)
64 {
65 frame.Push(null);
66 }
67 else
68 {
69 frame.Push((ushort)((ushort)obj - 1));
70 }
71 return 1;
72 }
73 }
74
76 {
77 public override int Run(InterpretedFrame frame)
78 {
79 object obj = frame.Pop();
80 if (obj == null)
81 {
82 frame.Push(null);
83 }
84 else
85 {
86 frame.Push((uint)obj - 1);
87 }
88 return 1;
89 }
90 }
91
93 {
94 public override int Run(InterpretedFrame frame)
95 {
96 object obj = frame.Pop();
97 if (obj == null)
98 {
99 frame.Push(null);
100 }
101 else
102 {
103 frame.Push((ulong)obj - 1);
104 }
105 return 1;
106 }
107 }
108
110 {
111 public override int Run(InterpretedFrame frame)
112 {
113 object obj = frame.Pop();
114 if (obj == null)
115 {
116 frame.Push(null);
117 }
118 else
119 {
120 frame.Push((float)obj - 1f);
121 }
122 return 1;
123 }
124 }
125
127 {
128 public override int Run(InterpretedFrame frame)
129 {
130 object obj = frame.Pop();
131 if (obj == null)
132 {
133 frame.Push(null);
134 }
135 else
136 {
137 frame.Push((double)obj - 1.0);
138 }
139 return 1;
140 }
141 }
142
143 private static Instruction s_Int16;
144
145 private static Instruction s_Int32;
146
147 private static Instruction s_Int64;
148
149 private static Instruction s_UInt16;
150
151 private static Instruction s_UInt32;
152
153 private static Instruction s_UInt64;
154
155 private static Instruction s_Single;
156
157 private static Instruction s_Double;
158
159 public override int ConsumedStack => 1;
160
161 public override int ProducedStack => 1;
162
163 public override string InstructionName => "Decrement";
164
166 {
167 }
168
170 {
171 return type.GetNonNullableType().GetTypeCode() switch
172 {
173 TypeCode.Int16 => s_Int16 ?? (s_Int16 = new DecrementInt16()),
174 TypeCode.Int32 => s_Int32 ?? (s_Int32 = new DecrementInt32()),
175 TypeCode.Int64 => s_Int64 ?? (s_Int64 = new DecrementInt64()),
176 TypeCode.UInt16 => s_UInt16 ?? (s_UInt16 = new DecrementUInt16()),
177 TypeCode.UInt32 => s_UInt32 ?? (s_UInt32 = new DecrementUInt32()),
178 TypeCode.UInt64 => s_UInt64 ?? (s_UInt64 = new DecrementUInt64()),
179 TypeCode.Single => s_Single ?? (s_Single = new DecrementSingle()),
180 TypeCode.Double => s_Double ?? (s_Double = new DecrementDouble()),
181 _ => throw ContractUtils.Unreachable,
182 };
183 }
184}
TypeCode
Definition TypeCode.cs:4