CON_USE_COMPUTED_GOTO eval macro micro-optimization

This is almost as fast as ditching the bounds check here entirely.

git-svn-id: https://svn.eduke32.com/eduke32@7657 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2019-05-19 03:54:56 +00:00 committed by Christoph Oelckers
parent 61d2e31610
commit 7659e816fa

View file

@ -1264,7 +1264,7 @@ void Screen_Play(void)
#ifdef CON_USE_COMPUTED_GOTO #ifdef CON_USE_COMPUTED_GOTO
# define vInstruction(KEYWORDID) VINST_ ## KEYWORDID # define vInstruction(KEYWORDID) VINST_ ## KEYWORDID
# define vmErrorCase VINST_CON_OPCODE_END # define vmErrorCase VINST_CON_OPCODE_END
# define eval(INSTRUCTION) { if ((unsigned)INSTRUCTION < CON_OPCODE_END) goto *jumpTable[INSTRUCTION]; else goto vmErrorCase; } # define eval(INSTRUCTION) { goto *jumpTable[min<uint16_t>((unsigned)INSTRUCTION, CON_OPCODE_END)]; }
# define dispatch_unconditionally(...) { tw = *insptr; g_errorLineNum = tw >> 12; g_tw = tw &= VM_INSTMASK; eval(tw) } # define dispatch_unconditionally(...) { tw = *insptr; g_errorLineNum = tw >> 12; g_tw = tw &= VM_INSTMASK; eval(tw) }
# define dispatch(...) { if (vm_execution_depth && (vm.flags & (VM_RETURN|VM_KILL|VM_NOEXECUTE)) == 0) dispatch_unconditionally(__VA_ARGS__); return; } # define dispatch(...) { if (vm_execution_depth && (vm.flags & (VM_RETURN|VM_KILL|VM_NOEXECUTE)) == 0) dispatch_unconditionally(__VA_ARGS__); return; }
# define abort_after_error(...) return # define abort_after_error(...) return