Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
NotEqualInstruction.cs
Go to the documentation of this file.
2
4
5internal abstract class NotEqualInstruction : Instruction
6{
7 private sealed class NotEqualBoolean : NotEqualInstruction
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: true);
20 }
21 else
22 {
23 frame.Push((bool)obj2 != (bool)obj);
24 }
25 return 1;
26 }
27 }
28
29 private sealed class NotEqualSByte : NotEqualInstruction
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: true);
42 }
43 else
44 {
45 frame.Push((sbyte)obj2 != (sbyte)obj);
46 }
47 return 1;
48 }
49 }
50
51 private sealed class NotEqualInt16 : NotEqualInstruction
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: true);
64 }
65 else
66 {
67 frame.Push((short)obj2 != (short)obj);
68 }
69 return 1;
70 }
71 }
72
73 private sealed class NotEqualChar : NotEqualInstruction
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: true);
86 }
87 else
88 {
89 frame.Push((char)obj2 != (char)obj);
90 }
91 return 1;
92 }
93 }
94
95 private sealed class NotEqualInt32 : NotEqualInstruction
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: true);
108 }
109 else
110 {
111 frame.Push((int)obj2 != (int)obj);
112 }
113 return 1;
114 }
115 }
116
117 private sealed class NotEqualInt64 : NotEqualInstruction
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: true);
130 }
131 else
132 {
133 frame.Push((long)obj2 != (long)obj);
134 }
135 return 1;
136 }
137 }
138
139 private sealed class NotEqualByte : NotEqualInstruction
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: true);
152 }
153 else
154 {
155 frame.Push((byte)obj2 != (byte)obj);
156 }
157 return 1;
158 }
159 }
160
161 private sealed class NotEqualUInt16 : NotEqualInstruction
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: true);
174 }
175 else
176 {
177 frame.Push((ushort)obj2 != (ushort)obj);
178 }
179 return 1;
180 }
181 }
182
183 private sealed class NotEqualUInt32 : NotEqualInstruction
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: true);
196 }
197 else
198 {
199 frame.Push((uint)obj2 != (uint)obj);
200 }
201 return 1;
202 }
203 }
204
205 private sealed class NotEqualUInt64 : NotEqualInstruction
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: true);
218 }
219 else
220 {
221 frame.Push((ulong)obj2 != (ulong)obj);
222 }
223 return 1;
224 }
225 }
226
227 private sealed class NotEqualSingle : NotEqualInstruction
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: true);
240 }
241 else
242 {
243 frame.Push((float)obj2 != (float)obj);
244 }
245 return 1;
246 }
247 }
248
249 private sealed class NotEqualDouble : NotEqualInstruction
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: true);
262 }
263 else
264 {
265 frame.Push((double)obj2 != (double)obj);
266 }
267 return 1;
268 }
269 }
270
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((sbyte)obj2 != (sbyte)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((short)obj2 != (short)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((char)obj2 != (char)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((int)obj2 != (int)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((long)obj2 != (long)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((byte)obj2 != (byte)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((ushort)obj2 != (ushort)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((uint)obj2 != (uint)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((ulong)obj2 != (ulong)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((float)obj2 != (float)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((double)obj2 != (double)obj);
473 }
474 return 1;
475 }
476 }
477
478 private static Instruction s_reference;
479
480 private static Instruction s_Boolean;
481
482 private static Instruction s_SByte;
483
484 private static Instruction s_Int16;
485
486 private static Instruction s_Char;
487
488 private static Instruction s_Int32;
489
490 private static Instruction s_Int64;
491
492 private static Instruction s_Byte;
493
494 private static Instruction s_UInt16;
495
496 private static Instruction s_UInt32;
497
498 private static Instruction s_UInt64;
499
500 private static Instruction s_Single;
501
502 private static Instruction s_Double;
503
505
507
509
511
513
515
517
519
521
523
525
526 public override int ConsumedStack => 2;
527
528 public override int ProducedStack => 1;
529
530 public override string InstructionName => "NotEqual";
531
533 {
534 }
535
536 public static Instruction Create(Type type, bool liftedToNull)
537 {
538 if (liftedToNull)
539 {
540 return type.GetNonNullableType().GetTypeCode() switch
541 {
542 TypeCode.Boolean => ExclusiveOrInstruction.Create(type),
554 };
555 }
556 return type.GetNonNullableType().GetTypeCode() switch
557 {
558 TypeCode.Boolean => s_Boolean ?? (s_Boolean = new NotEqualBoolean()),
559 TypeCode.SByte => s_SByte ?? (s_SByte = new NotEqualSByte()),
560 TypeCode.Int16 => s_Int16 ?? (s_Int16 = new NotEqualInt16()),
561 TypeCode.Char => s_Char ?? (s_Char = new NotEqualChar()),
562 TypeCode.Int32 => s_Int32 ?? (s_Int32 = new NotEqualInt32()),
563 TypeCode.Int64 => s_Int64 ?? (s_Int64 = new NotEqualInt64()),
564 TypeCode.Byte => s_Byte ?? (s_Byte = new NotEqualByte()),
565 TypeCode.UInt16 => s_UInt16 ?? (s_UInt16 = new NotEqualUInt16()),
566 TypeCode.UInt32 => s_UInt32 ?? (s_UInt32 = new NotEqualUInt32()),
567 TypeCode.UInt64 => s_UInt64 ?? (s_UInt64 = new NotEqualUInt64()),
568 TypeCode.Single => s_Single ?? (s_Single = new NotEqualSingle()),
569 TypeCode.Double => s_Double ?? (s_Double = new NotEqualDouble()),
570 _ => s_reference ?? (s_reference = new NotEqualReference()),
571 };
572 }
573}
static Instruction Create(Type type, bool liftedToNull)
TypeCode
Definition TypeCode.cs:4