From 9bc1279af19385159303ae143c4ec05f84922e6d Mon Sep 17 00:00:00 2001 From: David Anderson Date: Tue, 10 Oct 2006 17:22:28 +0000 Subject: [PATCH] fixed casetbl not being aligned correctly fixed bitshifting the wrong way (oops!) --HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40113 --- sourcepawn/vm/jit/x86/jit_x86.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sourcepawn/vm/jit/x86/jit_x86.cpp b/sourcepawn/vm/jit/x86/jit_x86.cpp index 8e6e4e6e2..ee7120cea 100644 --- a/sourcepawn/vm/jit/x86/jit_x86.cpp +++ b/sourcepawn/vm/jit/x86/jit_x86.cpp @@ -1280,7 +1280,7 @@ inline void WriteOp_JsGeq(JitWriter *jit) inline void WriteOp_Switch(JitWriter *jit) { cell_t offs = jit->read_cell(); - cell_t *tbl = (cell_t *)((char *)jit->inbase + offs); + cell_t *tbl = (cell_t *)((char *)jit->inbase + offs + sizeof(cell_t)); struct casetbl { @@ -1348,9 +1348,9 @@ inline void WriteOp_Switch(JitWriter *jit) * ECX still has the correctly bound offset in it, luckily! * thus, we simply need to relocate ECX and store the cases. */ - //shr ecx, 2 + //shl ecx, 2 //add ecx, - IA32_Shr_Rm_Imm8(jit, AMX_REG_TMP, 2, MOD_REG); + IA32_Shl_Rm_Imm8(jit, AMX_REG_TMP, 2, MOD_REG); jitoffs_t tbl_offs = IA32_Add_Rm_Imm32_Later(jit, AMX_REG_TMP, MOD_REG); IA32_Jump_Rm(jit, AMX_REG_TMP, MOD_MEM_REG); /* The case table starts here. Go back and write the output pointer. */