Compilation fix 2

This commit is contained in:
Nekotekina 2014-08-30 00:26:27 +04:00
parent 6cb2518a81
commit d14f22d059
2 changed files with 17 additions and 12 deletions

View File

@ -771,10 +771,10 @@ private:
{ {
float result = CPU.VPR[vb]._f[w] * nScale; float result = CPU.VPR[vb]._f[w] * nScale;
if (result > INT_MAX) if (result > S32_MAX)
CPU.VPR[vd]._s32[w] = (int)INT_MAX; CPU.VPR[vd]._s32[w] = (int)S32_MAX;
else if (result < INT_MIN) else if (result < S32_MIN)
CPU.VPR[vd]._s32[w] = (int)INT_MIN; CPU.VPR[vd]._s32[w] = (int)S32_MIN;
else // C rounding = Round towards 0 else // C rounding = Round towards 0
CPU.VPR[vd]._s32[w] = (int)result; CPU.VPR[vd]._s32[w] = (int)result;
} }
@ -788,8 +788,8 @@ private:
// C rounding = Round towards 0 // C rounding = Round towards 0
s64 result = (s64)(CPU.VPR[vb]._f[w] * nScale); s64 result = (s64)(CPU.VPR[vb]._f[w] * nScale);
if (result > UINT_MAX) if (result > U32_MAX)
CPU.VPR[vd]._u32[w] = (u32)UINT_MAX; CPU.VPR[vd]._u32[w] = (u32)U32_MAX;
else if (result < 0) else if (result < 0)
CPU.VPR[vd]._u32[w] = 0; CPU.VPR[vd]._u32[w] = 0;
else else
@ -1061,14 +1061,14 @@ private:
result += CPU.VPR[vc]._s32[w]; result += CPU.VPR[vc]._s32[w];
if (result > INT_MAX) if (result > S32_MAX)
{ {
saturated = INT_MAX; saturated = S32_MAX;
CPU.VSCR.SAT = 1; CPU.VSCR.SAT = 1;
} }
else if (result < INT_MIN) else if (result < S32_MIN)
{ {
saturated = INT_MIN; saturated = S32_MIN;
CPU.VSCR.SAT = 1; CPU.VSCR.SAT = 1;
} }
else else
@ -1121,9 +1121,9 @@ private:
result += CPU.VPR[vc]._u32[w]; result += CPU.VPR[vc]._u32[w];
if (result > UINT_MAX) if (result > U32_MAX)
{ {
saturated = UINT_MAX; saturated = U32_MAX;
CPU.VSCR.SAT = 1; CPU.VSCR.SAT = 1;
} }
else else

View File

@ -42,11 +42,16 @@ typedef uint16_t u16;
typedef uint32_t u32; typedef uint32_t u32;
typedef uint64_t u64; typedef uint64_t u64;
static const u32 U32_MAX = 0xffffffff;
typedef int8_t s8; typedef int8_t s8;
typedef int16_t s16; typedef int16_t s16;
typedef int32_t s32; typedef int32_t s32;
typedef int64_t s64; typedef int64_t s64;
static const s32 S32_MIN = -0x80000000;
static const s32 S32_MAX = 0x7fffffff;
union u128 union u128
{ {
struct struct