Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
LeftShiftInstruction.cs
Go to the documentation of this file.
2
4
5internal abstract class LeftShiftInstruction : Instruction
6{
7 private sealed class LeftShiftSByte : LeftShiftInstruction
8 {
9 public override int Run(InterpretedFrame frame)
10 {
11 object obj = frame.Pop();
12 object obj2 = frame.Pop();
13 if (obj2 == null || obj == null)
14 {
15 frame.Push(null);
16 }
17 else
18 {
19 frame.Push((sbyte)((sbyte)obj2 << (int)obj));
20 }
21 return 1;
22 }
23 }
24
25 private sealed class LeftShiftInt16 : LeftShiftInstruction
26 {
27 public override int Run(InterpretedFrame frame)
28 {
29 object obj = frame.Pop();
30 object obj2 = frame.Pop();
31 if (obj2 == null || obj == null)
32 {
33 frame.Push(null);
34 }
35 else
36 {
37 frame.Push((short)((short)obj2 << (int)obj));
38 }
39 return 1;
40 }
41 }
42
43 private sealed class LeftShiftInt32 : LeftShiftInstruction
44 {
45 public override int Run(InterpretedFrame frame)
46 {
47 object obj = frame.Pop();
48 object obj2 = frame.Pop();
49 if (obj2 == null || obj == null)
50 {
51 frame.Push(null);
52 }
53 else
54 {
55 frame.Push((int)obj2 << (int)obj);
56 }
57 return 1;
58 }
59 }
60
61 private sealed class LeftShiftInt64 : LeftShiftInstruction
62 {
63 public override int Run(InterpretedFrame frame)
64 {
65 object obj = frame.Pop();
66 object obj2 = frame.Pop();
67 if (obj2 == null || obj == null)
68 {
69 frame.Push(null);
70 }
71 else
72 {
73 frame.Push((long)obj2 << (int)obj);
74 }
75 return 1;
76 }
77 }
78
79 private sealed class LeftShiftByte : LeftShiftInstruction
80 {
81 public override int Run(InterpretedFrame frame)
82 {
83 object obj = frame.Pop();
84 object obj2 = frame.Pop();
85 if (obj2 == null || obj == null)
86 {
87 frame.Push(null);
88 }
89 else
90 {
91 frame.Push((byte)((byte)obj2 << (int)obj));
92 }
93 return 1;
94 }
95 }
96
98 {
99 public override int Run(InterpretedFrame frame)
100 {
101 object obj = frame.Pop();
102 object obj2 = frame.Pop();
103 if (obj2 == null || obj == null)
104 {
105 frame.Push(null);
106 }
107 else
108 {
109 frame.Push((ushort)((ushort)obj2 << (int)obj));
110 }
111 return 1;
112 }
113 }
114
116 {
117 public override int Run(InterpretedFrame frame)
118 {
119 object obj = frame.Pop();
120 object obj2 = frame.Pop();
121 if (obj2 == null || obj == null)
122 {
123 frame.Push(null);
124 }
125 else
126 {
127 frame.Push((uint)obj2 << (int)obj);
128 }
129 return 1;
130 }
131 }
132
134 {
135 public override int Run(InterpretedFrame frame)
136 {
137 object obj = frame.Pop();
138 object obj2 = frame.Pop();
139 if (obj2 == null || obj == null)
140 {
141 frame.Push(null);
142 }
143 else
144 {
145 frame.Push((ulong)obj2 << (int)obj);
146 }
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 public override int ConsumedStack => 2;
168
169 public override int ProducedStack => 1;
170
171 public override string InstructionName => "LeftShift";
172
174 {
175 }
176
178 {
179 return type.GetNonNullableType().GetTypeCode() switch
180 {
181 TypeCode.SByte => s_SByte ?? (s_SByte = new LeftShiftSByte()),
182 TypeCode.Int16 => s_Int16 ?? (s_Int16 = new LeftShiftInt16()),
183 TypeCode.Int32 => s_Int32 ?? (s_Int32 = new LeftShiftInt32()),
184 TypeCode.Int64 => s_Int64 ?? (s_Int64 = new LeftShiftInt64()),
185 TypeCode.Byte => s_Byte ?? (s_Byte = new LeftShiftByte()),
186 TypeCode.UInt16 => s_UInt16 ?? (s_UInt16 = new LeftShiftUInt16()),
187 TypeCode.UInt32 => s_UInt32 ?? (s_UInt32 = new LeftShiftUInt32()),
188 TypeCode.UInt64 => s_UInt64 ?? (s_UInt64 = new LeftShiftUInt64()),
189 _ => throw ContractUtils.Unreachable,
190 };
191 }
192}
TypeCode
Definition TypeCode.cs:4