Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
ExclusiveOrInstruction.cs
Go to the documentation of this file.
2
4
5internal abstract class ExclusiveOrInstruction : Instruction
6{
8 {
9 public override int Run(InterpretedFrame frame)
10 {
11 object obj = frame.Pop();
12 object obj2 = frame.Pop();
13 if (obj == null || obj2 == null)
14 {
15 frame.Push(null);
16 return 1;
17 }
18 frame.Push((sbyte)((sbyte)obj ^ (sbyte)obj2));
19 return 1;
20 }
21 }
22
24 {
25 public override int Run(InterpretedFrame frame)
26 {
27 object obj = frame.Pop();
28 object obj2 = frame.Pop();
29 if (obj == null || obj2 == null)
30 {
31 frame.Push(null);
32 return 1;
33 }
34 frame.Push((short)((short)obj ^ (short)obj2));
35 return 1;
36 }
37 }
38
40 {
41 public override int Run(InterpretedFrame frame)
42 {
43 object obj = frame.Pop();
44 object obj2 = frame.Pop();
45 if (obj == null || obj2 == null)
46 {
47 frame.Push(null);
48 return 1;
49 }
50 frame.Push((int)obj ^ (int)obj2);
51 return 1;
52 }
53 }
54
56 {
57 public override int Run(InterpretedFrame frame)
58 {
59 object obj = frame.Pop();
60 object obj2 = frame.Pop();
61 if (obj == null || obj2 == null)
62 {
63 frame.Push(null);
64 return 1;
65 }
66 frame.Push((long)obj ^ (long)obj2);
67 return 1;
68 }
69 }
70
72 {
73 public override int Run(InterpretedFrame frame)
74 {
75 object obj = frame.Pop();
76 object obj2 = frame.Pop();
77 if (obj == null || obj2 == null)
78 {
79 frame.Push(null);
80 return 1;
81 }
82 frame.Push((byte)((byte)obj ^ (byte)obj2));
83 return 1;
84 }
85 }
86
88 {
89 public override int Run(InterpretedFrame frame)
90 {
91 object obj = frame.Pop();
92 object obj2 = frame.Pop();
93 if (obj == null || obj2 == null)
94 {
95 frame.Push(null);
96 return 1;
97 }
98 frame.Push((ushort)((ushort)obj ^ (ushort)obj2));
99 return 1;
100 }
101 }
102
104 {
105 public override int Run(InterpretedFrame frame)
106 {
107 object obj = frame.Pop();
108 object obj2 = frame.Pop();
109 if (obj == null || obj2 == null)
110 {
111 frame.Push(null);
112 return 1;
113 }
114 frame.Push((uint)obj ^ (uint)obj2);
115 return 1;
116 }
117 }
118
120 {
121 public override int Run(InterpretedFrame frame)
122 {
123 object obj = frame.Pop();
124 object obj2 = frame.Pop();
125 if (obj == null || obj2 == null)
126 {
127 frame.Push(null);
128 return 1;
129 }
130 frame.Push((ulong)obj ^ (ulong)obj2);
131 return 1;
132 }
133 }
134
136 {
137 public override int Run(InterpretedFrame frame)
138 {
139 object obj = frame.Pop();
140 object obj2 = frame.Pop();
141 if (obj == null || obj2 == null)
142 {
143 frame.Push(null);
144 return 1;
145 }
146 frame.Push((bool)obj ^ (bool)obj2);
147 return 1;
148 }
149 }
150
151 private static Instruction s_SByte;
152
153 private static Instruction s_Int16;
154
155 private static Instruction s_Int32;
156
157 private static Instruction s_Int64;
158
159 private static Instruction s_Byte;
160
161 private static Instruction s_UInt16;
162
163 private static Instruction s_UInt32;
164
165 private static Instruction s_UInt64;
166
167 private static Instruction s_Boolean;
168
169 public override int ConsumedStack => 2;
170
171 public override int ProducedStack => 1;
172
173 public override string InstructionName => "ExclusiveOr";
174
176 {
177 }
178
180 {
181 return type.GetNonNullableType().GetTypeCode() switch
182 {
183 TypeCode.SByte => s_SByte ?? (s_SByte = new ExclusiveOrSByte()),
184 TypeCode.Int16 => s_Int16 ?? (s_Int16 = new ExclusiveOrInt16()),
185 TypeCode.Int32 => s_Int32 ?? (s_Int32 = new ExclusiveOrInt32()),
186 TypeCode.Int64 => s_Int64 ?? (s_Int64 = new ExclusiveOrInt64()),
187 TypeCode.Byte => s_Byte ?? (s_Byte = new ExclusiveOrByte()),
188 TypeCode.UInt16 => s_UInt16 ?? (s_UInt16 = new ExclusiveOrUInt16()),
189 TypeCode.UInt32 => s_UInt32 ?? (s_UInt32 = new ExclusiveOrUInt32()),
190 TypeCode.UInt64 => s_UInt64 ?? (s_UInt64 = new ExclusiveOrUInt64()),
191 TypeCode.Boolean => s_Boolean ?? (s_Boolean = new ExclusiveOrBoolean()),
192 _ => throw ContractUtils.Unreachable,
193 };
194 }
195}
TypeCode
Definition TypeCode.cs:4