summaryrefslogtreecommitdiff
path: root/src/qcommon/vm_interpreted.c
diff options
context:
space:
mode:
authorTim Angus <tim@ngus.net>2011-01-24 22:07:34 +0000
committerTim Angus <tim@ngus.net>2013-01-03 00:17:54 +0000
commitf96ae257eab6fae9b4b4f4409c58dbce6915ac35 (patch)
treec9828a3c3726d4b260493a710fd1f2f9f7bc6056 /src/qcommon/vm_interpreted.c
parenta0101a6294268ef392b3fa4ecad12706e6cf4cf3 (diff)
* Merge ioq3-r1813
Diffstat (limited to 'src/qcommon/vm_interpreted.c')
-rw-r--r--src/qcommon/vm_interpreted.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/qcommon/vm_interpreted.c b/src/qcommon/vm_interpreted.c
index 53357f5d..2b9ffea6 100644
--- a/src/qcommon/vm_interpreted.c
+++ b/src/qcommon/vm_interpreted.c
@@ -517,18 +517,20 @@ nextInstruction2:
//VM_LogSyscalls( (int *)&image[ programStack + 4 ] );
{
- intptr_t* argptr = (intptr_t *)&image[ programStack + 4 ];
- #if __WORDSIZE == 64
- // the vm has ints on the stack, we expect
- // longs so we have to convert it
- intptr_t argarr[16];
- int i;
- for (i = 0; i < 16; ++i) {
- argarr[i] = *(int*)&image[ programStack + 4 + 4*i ];
+ // the vm has ints on the stack, we expect
+ // pointers so we might have to convert it
+ if (sizeof(intptr_t) != sizeof(int)) {
+ intptr_t argarr[16];
+ int *imagePtr = (int *)&image[programStack];
+ int i;
+ for (i = 0; i < 16; ++i) {
+ argarr[i] = *(++imagePtr);
+ }
+ r = vm->systemCall( argarr );
+ } else {
+ intptr_t* argptr = (intptr_t *)&image[ programStack + 4 ];
+ r = vm->systemCall( argptr );
}
- argptr = argarr;
- #endif
- r = vm->systemCall( argptr );
}
#ifdef DEBUG_VM