- Use a union, rather than pointer aliasing, to access the parts of a VM instruction.

SVN r1922 (scripting)
This commit is contained in:
Randy Heit 2009-10-17 00:33:23 +00:00
commit e5ef25591d
10 changed files with 171 additions and 154 deletions

View file

@ -15,7 +15,7 @@ VMScriptFunction::VMScriptFunction()
KonstS = NULL;
KonstA = NULL;
ExtraSpace = 0;
NumCodeBytes = 0;
CodeSize = 0;
NumRegD = 0;
NumRegF = 0;
NumRegS = 0;
@ -37,12 +37,11 @@ VMScriptFunction::~VMScriptFunction()
if (KonstA != NULL) M_Free(KonstA);
}
VM_UBYTE *VMScriptFunction::AllocCode(int numops)
VMOP *VMScriptFunction::AllocCode(int numops)
{
assert(Code == NULL && numops > 0);
numops *= VM_OPSIZE;
NumCodeBytes = numops;
return Code = (VM_UBYTE *)M_Malloc(numops);
CodeSize = numops;
return Code = (VMOP *)M_Malloc(numops * sizeof(VMOP));
}
int *VMScriptFunction::AllocKonstD(int numkonst)