Skip to content

Commit 40d4cf6

Browse files
committed
Update lookupswitch
1 parent 9548287 commit 40d4cf6

3 files changed

Lines changed: 43 additions & 4 deletions

File tree

β€Žsrc/kernel/mnemonics/_lookupswitch.phpβ€Ž

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,19 @@ public function execute(): void
1313
{
1414
$key = $this->getStack();
1515

16-
$paddingData = $this->readByte() + $this->readByte() + $this->readByte();
17-
18-
$offsets = array();
16+
// padding data
17+
$paddingData = 4 - (($this->getOffset()) % 4);
18+
if ($paddingData != 4) {
19+
$this->read($paddingData);
20+
}
1921

22+
$offsets = [];
2023
$offsets['default'] = $this->readInt();
2124
$switchSize = $this->readUnsignedInt();
2225

2326

2427
for ($i = 0; $i < $switchSize; $i++) {
2528
$label = $this->readInt();
26-
2729
$offsets[(string) $label] = $this->readInt();
2830
}
2931

β€Žtools/Test.classβ€Ž

186 Bytes
Binary file not shown.

β€Žtools/test.javaβ€Ž

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,43 @@ public String testMe (int n, String m, int l, int i, int v, int k) {
295295
}
296296

297297
public static void main (int[] args) {
298+
299+
300+
switch (3) {
301+
302+
case -20:
303+
304+
System.out.println("ねこ");
305+
306+
break;
307+
case -1111:
308+
309+
System.out.println("ねこ");
310+
311+
break;
312+
case 999:
313+
314+
System.out.println("こねこね");
315+
316+
break;
317+
case 3333:
318+
319+
System.out.println("こねこね");
320+
321+
break;
322+
case 929292:
323+
324+
System.out.println("γ†γ•γŽ");
325+
326+
break;
327+
case 3:
328+
329+
System.out.println("γ†γ•γŽ");
330+
331+
break;
332+
333+
}
334+
298335
System.out.println("Called int type main " + args[0]);
299336
System.out.println(c);
300337
System.out.println(Test.b);

0 commit comments

Comments
Β (0)