Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
EqualInstruction.cs
Go to the documentation of this file.
2
4
5internal abstract class EqualInstruction : Instruction
6{
7 private sealed class EqualBoolean : EqualInstruction
8 {
9 public override int Run(InterpretedFrame frame)
10 {
11 object obj = frame.Pop();
12 object obj2 = frame.Pop();
13 if (obj2 == null)
14 {
15 frame.Push(obj == null);
16 }
17 else if (obj == null)
18 {
19 frame.Push(value: false);
20 }
21 else
22 {
23 frame.Push((bool)obj2 == (bool)obj);
24 }
25 return 1;
26 }
27 }
28
29 private sealed class EqualSByte : EqualInstruction
30 {
31 public override int Run(InterpretedFrame frame)
32 {
33 object obj = frame.Pop();
34 object obj2 = frame.Pop();
35 if (obj2 == null)
36 {
37 frame.Push(obj == null);
38 }
39 else if (obj == null)
40 {
41 frame.Push(value: false);
42 }
43 else
44 {
45 frame.Push((sbyte)obj2 == (sbyte)obj);
46 }
47 return 1;
48 }
49 }
50
51 private sealed class EqualInt16 : EqualInstruction
52 {
53 public override int Run(InterpretedFrame frame)
54 {
55 object obj = frame.Pop();
56 object obj2 = frame.Pop();
57 if (obj2 == null)
58 {
59 frame.Push(obj == null);
60 }
61 else if (obj == null)
62 {
63 frame.Push(value: false);
64 }
65 else
66 {
67 frame.Push((short)obj2 == (short)obj);
68 }
69 return 1;
70 }
71 }
72
73 private sealed class EqualChar : EqualInstruction
74 {
75 public override int Run(InterpretedFrame frame)
76 {
77 object obj = frame.Pop();
78 object obj2 = frame.Pop();
79 if (obj2 == null)
80 {
81 frame.Push(obj == null);
82 }
83 else if (obj == null)
84 {
85 frame.Push(value: false);
86 }
87 else
88 {
89 frame.Push((char)obj2 == (char)obj);
90 }
91 return 1;
92 }
93 }
94
95 private sealed class EqualInt32 : EqualInstruction
96 {
97 public override int Run(InterpretedFrame frame)
98 {
99 object obj = frame.Pop();
100 object obj2 = frame.Pop();
101 if (obj2 == null)
102 {
103 frame.Push(obj == null);
104 }
105 else if (obj == null)
106 {
107 frame.Push(value: false);
108 }
109 else
110 {
111 frame.Push((int)obj2 == (int)obj);
112 }
113 return 1;
114 }
115 }
116
117 private sealed class EqualInt64 : EqualInstruction
118 {
119 public override int Run(InterpretedFrame frame)
120 {
121 object obj = frame.Pop();
122 object obj2 = frame.Pop();
123 if (obj2 == null)
124 {
125 frame.Push(obj == null);
126 }
127 else if (obj == null)
128 {
129 frame.Push(value: false);
130 }
131 else
132 {
133 frame.Push((long)obj2 == (long)obj);
134 }
135 return 1;
136 }
137 }
138
139 private sealed class EqualByte : EqualInstruction
140 {
141 public override int Run(InterpretedFrame frame)
142 {
143 object obj = frame.Pop();
144 object obj2 = frame.Pop();
145 if (obj2 == null)
146 {
147 frame.Push(obj == null);
148 }
149 else if (obj == null)
150 {
151 frame.Push(value: false);
152 }
153 else
154 {
155 frame.Push((byte)obj2 == (byte)obj);
156 }
157 return 1;
158 }
159 }
160
161 private sealed class EqualUInt16 : EqualInstruction
162 {
163 public override int Run(InterpretedFrame frame)
164 {
165 object obj = frame.Pop();
166 object obj2 = frame.Pop();
167 if (obj2 == null)
168 {
169 frame.Push(obj == null);
170 }
171 else if (obj == null)
172 {
173 frame.Push(value: false);
174 }
175 else
176 {
177 frame.Push((ushort)obj2 == (ushort)obj);
178 }
179 return 1;
180 }
181 }
182
183 private sealed class EqualUInt32 : EqualInstruction
184 {
185 public override int Run(InterpretedFrame frame)
186 {
187 object obj = frame.Pop();
188 object obj2 = frame.Pop();
189 if (obj2 == null)
190 {
191 frame.Push(obj == null);
192 }
193 else if (obj == null)
194 {
195 frame.Push(value: false);
196 }
197 else
198 {
199 frame.Push((uint)obj2 == (uint)obj);
200 }
201 return 1;
202 }
203 }
204
205 private sealed class EqualUInt64 : EqualInstruction
206 {
207 public override int Run(InterpretedFrame frame)
208 {
209 object obj = frame.Pop();
210 object obj2 = frame.Pop();
211 if (obj2 == null)
212 {
213 frame.Push(obj == null);
214 }
215 else if (obj == null)
216 {
217 frame.Push(value: false);
218 }
219 else
220 {
221 frame.Push((ulong)obj2 == (ulong)obj);
222 }
223 return 1;
224 }
225 }
226
227 private sealed class EqualSingle : EqualInstruction
228 {
229 public override int Run(InterpretedFrame frame)
230 {
231 object obj = frame.Pop();
232 object obj2 = frame.Pop();
233 if (obj2 == null)
234 {
235 frame.Push(obj == null);
236 }
237 else if (obj == null)
238 {
239 frame.Push(value: false);
240 }
241 else
242 {
243 frame.Push((float)obj2 == (float)obj);
244 }
245 return 1;
246 }
247 }
248
249 private sealed class EqualDouble : EqualInstruction
250 {
251 public override int Run(InterpretedFrame frame)
252 {
253 object obj = frame.Pop();
254 object obj2 = frame.Pop();
255 if (obj2 == null)
256 {
257 frame.Push(obj == null);
258 }
259 else if (obj == null)
260 {
261 frame.Push(value: false);
262 }
263 else
264 {
265 frame.Push((double)obj2 == (double)obj);
266 }
267 return 1;
268 }
269 }
270
271 private sealed class EqualReference : EqualInstruction
272 {
273 public override int Run(InterpretedFrame frame)
274 {
275 frame.Push(frame.Pop() == frame.Pop());
276 return 1;
277 }
278 }
279
281 {
282 public override int Run(InterpretedFrame frame)
283 {
284 object obj = frame.Pop();
285 object obj2 = frame.Pop();
286 if (obj2 == null || obj == null)
287 {
288 frame.Push(null);
289 }
290 else
291 {
292 frame.Push((bool)obj2 == (bool)obj);
293 }
294 return 1;
295 }
296 }
297
299 {
300 public override int Run(InterpretedFrame frame)
301 {
302 object obj = frame.Pop();
303 object obj2 = frame.Pop();
304 if (obj2 == null || obj == null)
305 {
306 frame.Push(null);
307 }
308 else
309 {
310 frame.Push((sbyte)obj2 == (sbyte)obj);
311 }
312 return 1;
313 }
314 }
315
317 {
318 public override int Run(InterpretedFrame frame)
319 {
320 object obj = frame.Pop();
321 object obj2 = frame.Pop();
322 if (obj2 == null || obj == null)
323 {
324 frame.Push(null);
325 }
326 else
327 {
328 frame.Push((short)obj2 == (short)obj);
329 }
330 return 1;
331 }
332 }
333
335 {
336 public override int Run(InterpretedFrame frame)
337 {
338 object obj = frame.Pop();
339 object obj2 = frame.Pop();
340 if (obj2 == null || obj == null)
341 {
342 frame.Push(null);
343 }
344 else
345 {
346 frame.Push((char)obj2 == (char)obj);
347 }
348 return 1;
349 }
350 }
351
353 {
354 public override int Run(InterpretedFrame frame)
355 {
356 object obj = frame.Pop();
357 object obj2 = frame.Pop();
358 if (obj2 == null || obj == null)
359 {
360 frame.Push(null);
361 }
362 else
363 {
364 frame.Push((int)obj2 == (int)obj);
365 }
366 return 1;
367 }
368 }
369
371 {
372 public override int Run(InterpretedFrame frame)
373 {
374 object obj = frame.Pop();
375 object obj2 = frame.Pop();
376 if (obj2 == null || obj == null)
377 {
378 frame.Push(null);
379 }
380 else
381 {
382 frame.Push((long)obj2 == (long)obj);
383 }
384 return 1;
385 }
386 }
387
389 {
390 public override int Run(InterpretedFrame frame)
391 {
392 object obj = frame.Pop();
393 object obj2 = frame.Pop();
394 if (obj2 == null || obj == null)
395 {
396 frame.Push(null);
397 }
398 else
399 {
400 frame.Push((byte)obj2 == (byte)obj);
401 }
402 return 1;
403 }
404 }
405
407 {
408 public override int Run(InterpretedFrame frame)
409 {
410 object obj = frame.Pop();
411 object obj2 = frame.Pop();
412 if (obj2 == null || obj == null)
413 {
414 frame.Push(null);
415 }
416 else
417 {
418 frame.Push((ushort)obj2 == (ushort)obj);
419 }
420 return 1;
421 }
422 }
423
425 {
426 public override int Run(InterpretedFrame frame)
427 {
428 object obj = frame.Pop();
429 object obj2 = frame.Pop();
430 if (obj2 == null || obj == null)
431 {
432 frame.Push(null);
433 }
434 else
435 {
436 frame.Push((uint)obj2 == (uint)obj);
437 }
438 return 1;
439 }
440 }
441
443 {
444 public override int Run(InterpretedFrame frame)
445 {
446 object obj = frame.Pop();
447 object obj2 = frame.Pop();
448 if (obj2 == null || obj == null)
449 {
450 frame.Push(null);
451 }
452 else
453 {
454 frame.Push((ulong)obj2 == (ulong)obj);
455 }
456 return 1;
457 }
458 }
459
461 {
462 public override int Run(InterpretedFrame frame)
463 {
464 object obj = frame.Pop();
465 object obj2 = frame.Pop();
466 if (obj2 == null || obj == null)
467 {
468 frame.Push(null);
469 }
470 else
471 {
472 frame.Push((float)obj2 == (float)obj);
473 }
474 return 1;
475 }
476 }
477
479 {
480 public override int Run(InterpretedFrame frame)
481 {
482 object obj = frame.Pop();
483 object obj2 = frame.Pop();
484 if (obj2 == null || obj == null)
485 {
486 frame.Push(null);
487 }
488 else
489 {
490 frame.Push((double)obj2 == (double)obj);
491 }
492 return 1;
493 }
494 }
495
496 private static Instruction s_reference;
497
498 private static Instruction s_Boolean;
499
500 private static Instruction s_SByte;
501
502 private static Instruction s_Int16;
503
504 private static Instruction s_Char;
505
506 private static Instruction s_Int32;
507
508 private static Instruction s_Int64;
509
510 private static Instruction s_Byte;
511
512 private static Instruction s_UInt16;
513
514 private static Instruction s_UInt32;
515
516 private static Instruction s_UInt64;
517
518 private static Instruction s_Single;
519
520 private static Instruction s_Double;
521
523
525
527
529
531
533
535
537
539
541
543
545
546 public override int ConsumedStack => 2;
547
548 public override int ProducedStack => 1;
549
550 public override string InstructionName => "Equal";
551
553 {
554 }
555
556 public static Instruction Create(Type type, bool liftedToNull)
557 {
558 if (liftedToNull)
559 {
560 return type.GetNonNullableType().GetTypeCode() switch
561 {
574 };
575 }
576 return type.GetNonNullableType().GetTypeCode() switch
577 {
578 TypeCode.Boolean => s_Boolean ?? (s_Boolean = new EqualBoolean()),
579 TypeCode.SByte => s_SByte ?? (s_SByte = new EqualSByte()),
580 TypeCode.Int16 => s_Int16 ?? (s_Int16 = new EqualInt16()),
581 TypeCode.Char => s_Char ?? (s_Char = new EqualChar()),
582 TypeCode.Int32 => s_Int32 ?? (s_Int32 = new EqualInt32()),
583 TypeCode.Int64 => s_Int64 ?? (s_Int64 = new EqualInt64()),
584 TypeCode.Byte => s_Byte ?? (s_Byte = new EqualByte()),
585 TypeCode.UInt16 => s_UInt16 ?? (s_UInt16 = new EqualUInt16()),
586 TypeCode.UInt32 => s_UInt32 ?? (s_UInt32 = new EqualUInt32()),
587 TypeCode.UInt64 => s_UInt64 ?? (s_UInt64 = new EqualUInt64()),
588 TypeCode.Single => s_Single ?? (s_Single = new EqualSingle()),
589 TypeCode.Double => s_Double ?? (s_Double = new EqualDouble()),
590 _ => s_reference ?? (s_reference = new EqualReference()),
591 };
592 }
593}
static Instruction Create(Type type, bool liftedToNull)
TypeCode
Definition TypeCode.cs:4