Fixed some GCC pedantic warnings.

This commit is contained in:
OBattler
2023-08-25 02:28:51 +02:00
parent e578b6b418
commit 782117dbbd
8 changed files with 51 additions and 19 deletions

View File

@@ -40,8 +40,6 @@
extern int codegen_flags_changed;
static int fpu_cycles = 0;
#ifdef ENABLE_386_LOG
int x386_do_log = ENABLE_386_LOG;

View File

@@ -1,3 +1,6 @@
#ifndef EMU_SF_CONFIG_H
#define EMU_SF_CONFIG_H
#include <stdint.h>
typedef int8_t flag;
@@ -44,3 +47,5 @@ typedef int64_t Bit64s;
*----------------------------------------------------------------------------*/
#define BX_CONST64(a) a##LL
#define BX_CPP_INLINE static __inline
#endif /*EMU_SF_CONFIG_H*/

View File

@@ -78,6 +78,8 @@ uint32_t easeg;
int reset_on_hlt;
int hlt_reset_pending;
int fpu_cycles = 0;
#ifdef ENABLE_X86_LOG
void dumpregs(int);

View File

@@ -70,6 +70,8 @@ extern uint32_t *mod1seg[8];
extern uint32_t *eal_r;
extern uint32_t *eal_w;
extern int fpu_cycles;
#define fetchdat rmdat
#define setznp168 setznp16

View File

@@ -144,7 +144,7 @@ void codegen_set_rounding_mode(int mode);
#include "softfloat/softfloatx80.h"
static __inline const int
static __inline int
is_IA_masked(void)
{
return (fpu_state.cwd & FPU_CW_Invalid);

View File

@@ -169,13 +169,17 @@ x87_pop(void)
static __inline int16_t
x87_fround16(double b)
{
double da;
double dc;
int16_t a;
int16_t c;
switch ((cpu_state.npxc >> 10) & 3) {
case 0: /*Nearest*/
a = (int16_t) floor(b);
c = (int16_t) floor(b + 1.0);
da = floor(b);
dc = floor(b + 1.0);
a = (int16_t) da;
c = (int16_t) dc;
if ((b - a) < (c - b))
return a;
else if ((b - a) > (c - b))
@@ -183,9 +187,11 @@ x87_fround16(double b)
else
return (a & 1) ? c : a;
case 1: /*Down*/
return (int16_t) floor(b);
da = floor(b);
return (int16_t) da;
case 2: /*Up*/
return (int16_t) ceil(b);
da = ceil(b);
return (int16_t) da;
case 3: /*Chop*/
return (int16_t) b;
}
@@ -202,13 +208,17 @@ x87_fround16_64(double b)
static __inline int32_t
x87_fround32(double b)
{
double da;
double dc;
int32_t a;
int32_t c;
switch ((cpu_state.npxc >> 10) & 3) {
case 0: /*Nearest*/
a = (int32_t) floor(b);
c = (int32_t) floor(b + 1.0);
da = floor(b);
dc = floor(b + 1.0);
a = (int32_t) da;
c = (int32_t) dc;
if ((b - a) < (c - b))
return a;
else if ((b - a) > (c - b))
@@ -216,9 +226,11 @@ x87_fround32(double b)
else
return (a & 1) ? c : a;
case 1: /*Down*/
return (int32_t) floor(b);
da = floor(b);
return (int32_t) da;
case 2: /*Up*/
return (int32_t) ceil(b);
da = ceil(b);
return (int32_t) da;
case 3: /*Chop*/
return (int32_t) b;
}
@@ -235,13 +247,17 @@ x87_fround32_64(double b)
static __inline int64_t
x87_fround(double b)
{
double da;
double dc;
int64_t a;
int64_t c;
switch ((cpu_state.npxc >> 10) & 3) {
case 0: /*Nearest*/
a = (int64_t) floor(b);
c = (int64_t) floor(b + 1.0);
da = floor(b);
dc = floor(b + 1.0);
a = (int64_t) da;
c = (int64_t) dc;
if ((b - a) < (c - b))
return a;
else if ((b - a) > (c - b))
@@ -249,9 +265,11 @@ x87_fround(double b)
else
return (a & 1) ? c : a;
case 1: /*Down*/
return (int64_t) floor(b);
da = floor(b);
return (int64_t) da;
case 2: /*Up*/
return (int64_t) ceil(b);
da = ceil(b);
return (int64_t) da;
case 3: /*Chop*/
return (int64_t) b;
}

View File

@@ -147,6 +147,7 @@ opFILDiq_a32(uint32_t fetchdat)
static int
FBSTP_a16(uint32_t fetchdat)
{
double dt;
double tempd;
int c;
FP_ENTER();
@@ -156,15 +157,18 @@ FBSTP_a16(uint32_t fetchdat)
if (tempd < 0.0)
tempd = -tempd;
for (c = 0; c < 9; c++) {
uint8_t tempc = (uint8_t) floor(fmod(tempd, 10.0));
dt = floor(fmod(tempd, 10.0));
uint8_t tempc = (uint8_t) dt;
tempd -= floor(fmod(tempd, 10.0));
tempd /= 10.0;
tempc |= ((uint8_t) floor(fmod(tempd, 10.0))) << 4;
dt = floor(fmod(tempd, 10.0));
tempc |= ((uint8_t) dt) << 4;
tempd -= floor(fmod(tempd, 10.0));
tempd /= 10.0;
writememb(easeg, cpu_state.eaaddr + c, tempc);
}
tempc = (uint8_t) floor(fmod(tempd, 10.0));
dt = floor(fmod(tempd, 10.0));
tempc = (uint8_t) dt;
if (ST(0) < 0.0)
tempc |= 0x80;
writememb(easeg, cpu_state.eaaddr + 9, tempc);

View File

@@ -818,9 +818,12 @@ opFSINCOS(uint32_t fetchdat)
static int
opFRNDINT(uint32_t fetchdat)
{
double dst0;
FP_ENTER();
cpu_state.pc++;
ST(0) = (double) x87_fround(ST(0));
dst0 = x87_fround(ST(0));
ST(0) = (double) dst0;
FP_TAG_VALID;
CLOCK_CYCLES_FPU((fpu_type >= FPU_487SX) ? (x87_timings.frndint) : (x87_timings.frndint * cpu_multi));
CONCURRENCY_CYCLES((fpu_type >= FPU_487SX) ? (x87_concurrency.frndint) : (x87_concurrency.frndint * cpu_multi));