mirror of
https://github.com/ZDoom/qzdoom-gpl.git
synced 2024-11-29 15:12:11 +00:00
Fixed endianness issue in script VM
See https://forum.zdoom.org/viewtopic.php?t=54549
This commit is contained in:
parent
470a96d3b2
commit
3fe3abc51e
1 changed files with 16 additions and 5 deletions
|
@ -21,27 +21,35 @@ typedef VM_UBYTE VM_ATAG;
|
||||||
|
|
||||||
#define VM_EPSILON (1/65536.0)
|
#define VM_EPSILON (1/65536.0)
|
||||||
|
|
||||||
|
#ifdef __BIG_ENDIAN__
|
||||||
|
#define VM_DEFINE_OP2(TYPE, ARG1, ARG2) TYPE ARG2, ARG1
|
||||||
|
#define VM_DEFINE_OP4(TYPE, ARG1, ARG2, ARG3, ARG4) TYPE ARG4, ARG3, ARG2, ARG1
|
||||||
|
#else // little endian
|
||||||
|
#define VM_DEFINE_OP2(TYPE, ARG1, ARG2) TYPE ARG1, ARG2
|
||||||
|
#define VM_DEFINE_OP4(TYPE, ARG1, ARG2, ARG3, ARG4) TYPE ARG1, ARG2, ARG3, ARG4
|
||||||
|
#endif // __BIG_ENDIAN__
|
||||||
|
|
||||||
union VMOP
|
union VMOP
|
||||||
{
|
{
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
VM_UBYTE op, a, b, c;
|
VM_DEFINE_OP4(VM_UBYTE, op, a, b, c);
|
||||||
};
|
};
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
VM_SBYTE pad0, as, bs, cs;
|
VM_DEFINE_OP4(VM_SBYTE, pad0, as, bs, cs);
|
||||||
};
|
};
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
VM_SWORD pad1:8, i24:24;
|
VM_DEFINE_OP2(VM_SWORD, pad1:8, i24:24);
|
||||||
};
|
};
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
VM_SWORD pad2:16, i16:16;
|
VM_DEFINE_OP2(VM_SWORD, pad2:16, i16:16);
|
||||||
};
|
};
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
VM_UHALF pad3, i16u;
|
VM_DEFINE_OP2(VM_UHALF, pad3, i16u);
|
||||||
};
|
};
|
||||||
VM_UWORD word;
|
VM_UWORD word;
|
||||||
|
|
||||||
|
@ -56,6 +64,9 @@ union VMOP
|
||||||
// sar eax,10h
|
// sar eax,10h
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#undef VM_DEFINE_OP4
|
||||||
|
#undef VM_DEFINE_OP2
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
#include "vmops.h"
|
#include "vmops.h"
|
||||||
|
|
Loading…
Reference in a new issue