From: divverent Date: Sun, 13 Jan 2013 20:12:03 +0000 (+0000) Subject: make MUL_VF and MUL_FV friendlier for compilers, and fix segfaul in LOAD_V X-Git-Tag: xonotic-v0.7.0~70 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=5a2686be1ae3d6ae92098c3dbf5dde40d98853b1;p=xonotic%2Fdarkplaces.git make MUL_VF and MUL_FV friendlier for compilers, and fix segfaul in LOAD_V From: Wolfgang Bumiller git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11880 d7cf8633-e32d-0410-b094-e92efae38249 ::stable-branch::merge=daeb1932c1d2ec1eefde9ef89e93ed912d8d19d2 --- diff --git a/prvm_exec.c b/prvm_exec.c index d1ab2436..30ea8cf4 100644 --- a/prvm_exec.c +++ b/prvm_exec.c @@ -677,6 +677,7 @@ void MVM_ExecuteProgram (prvm_prog_t *prog, func_t fnum, const char *errormessag int restorevm_tempstringsbuf_cursize; double calltime; double tm, starttm; + prvm_vec_t tempfloat; calltime = Sys_DirtyTime(); @@ -768,6 +769,7 @@ void CLVM_ExecuteProgram (prvm_prog_t *prog, func_t fnum, const char *errormessa int restorevm_tempstringsbuf_cursize; double calltime; double tm, starttm; + prvm_vec_t tempfloat; calltime = Sys_DirtyTime(); @@ -864,6 +866,7 @@ void PRVM_ExecuteProgram (prvm_prog_t *prog, func_t fnum, const char *errormessa int restorevm_tempstringsbuf_cursize; double calltime; double tm, starttm; + prvm_vec_t tempfloat; calltime = Sys_DirtyTime(); diff --git a/prvm_execprogram.h b/prvm_execprogram.h index 0c9e4f47..8c6b0e47 100644 --- a/prvm_execprogram.h +++ b/prvm_execprogram.h @@ -70,14 +70,16 @@ OPC->_float = OPA->vector[0]*OPB->vector[0] + OPA->vector[1]*OPB->vector[1] + OPA->vector[2]*OPB->vector[2]; break; case OP_MUL_FV: - OPC->vector[0] = OPA->_float * OPB->vector[0]; - OPC->vector[1] = OPA->_float * OPB->vector[1]; - OPC->vector[2] = OPA->_float * OPB->vector[2]; + tempfloat = OPA->_float; + OPC->vector[0] = tempfloat * OPB->vector[0]; + OPC->vector[1] = tempfloat * OPB->vector[1]; + OPC->vector[2] = tempfloat * OPB->vector[2]; break; case OP_MUL_VF: - OPC->vector[0] = OPB->_float * OPA->vector[0]; - OPC->vector[1] = OPB->_float * OPA->vector[1]; - OPC->vector[2] = OPB->_float * OPA->vector[2]; + tempfloat = OPB->_float; + OPC->vector[0] = tempfloat * OPA->vector[0]; + OPC->vector[1] = tempfloat * OPA->vector[1]; + OPC->vector[2] = tempfloat * OPA->vector[2]; break; case OP_DIV_F: if( OPB->_float != 0.0f ) @@ -277,9 +279,10 @@ goto cleanup; } ed = PRVM_PROG_TO_EDICT(OPA->edict); - OPC->ivector[0] = ((prvm_eval_t *)(ed->fields.ip + OPB->_int))->ivector[0]; - OPC->ivector[1] = ((prvm_eval_t *)(ed->fields.ip + OPB->_int))->ivector[1]; - OPC->ivector[2] = ((prvm_eval_t *)(ed->fields.ip + OPB->_int))->ivector[2]; + ptr = (prvm_eval_t *)(ed->fields.ip + OPB->_int); + OPC->ivector[0] = ptr->ivector[0]; + OPC->ivector[1] = ptr->ivector[1]; + OPC->ivector[2] = ptr->ivector[2]; break; //==================