]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
make MUL_VF and MUL_FV friendlier for compilers, and fix segfaul in LOAD_V
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 13 Jan 2013 20:12:03 +0000 (20:12 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 13 Jan 2013 20:12:03 +0000 (20:12 +0000)
From: Wolfgang Bumiller <blub@speed.at>

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11880 d7cf8633-e32d-0410-b094-e92efae38249

prvm_exec.c
prvm_execprogram.h

index d1ab2436ef0ed4a5a017242d6945c2d92c065838..30ea8cf487905c8f53ea24df2f62209362e833b2 100644 (file)
@@ -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();
 
index 0c9e4f47cff2bb6a43a8a8f3ba203b64c1b06e0f..8c6b0e47eb3e66b9c6bb183073f6c8c53717845b 100644 (file)
                                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 )
                                        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;
 
                //==================