From bf6730d8a39ca5948456bab353ee5baaa5c52269 Mon Sep 17 00:00:00 2001 From: terminx Date: Sun, 19 May 2019 03:55:23 +0000 Subject: [PATCH] Minor optimization to avoid read-after-write in Gv_DivVar() git-svn-id: https://svn.eduke32.com/eduke32@7663 1a8010ca-5511-0410-912e-c29ae57300e0 --- source/duke3d/src/gamevars.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/duke3d/src/gamevars.h b/source/duke3d/src/gamevars.h index fe92690fb..1fd5456ed 100644 --- a/source/duke3d/src/gamevars.h +++ b/source/duke3d/src/gamevars.h @@ -240,10 +240,10 @@ static FORCE_INLINE void __fastcall Gv_DivVar(int const id, int32_t const operan (var.flags & GAMEVAR_PERACTOR && (unsigned) vm.spriteNum > MAXSPRITES - 1))) return; - static libdivide_s32_t sdiv; - static int32_t lastValue; - intptr_t *iptr = &var.global; bool const foundInTable = (unsigned) operand < DIVTABLESIZE; + static libdivide_s32_t sdiv; + intptr_t *iptr = &var.global; + static int32_t lastValue; auto dptr = foundInTable ? (libdivide_s32_t *) &divtable32[operand] : &sdiv; if (operand == lastValue || foundInTable)