mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-26 23:10:38 +00:00
Global: Fix some type conversion warnings.
Hidden by some warning disables.
This commit is contained in:
parent
5e185f3d87
commit
3df6cb704f
@ -53,11 +53,11 @@ bool IsPowerOfTwo(uint64_t x) {
|
||||
|
||||
bool IsImmArithmetic(uint64_t input, u32 *val, bool *shift) {
|
||||
if (input < 4096) {
|
||||
if (val) *val = input;
|
||||
if (val) *val = (uint32_t)input;
|
||||
if (shift) *shift = false;
|
||||
return true;
|
||||
} else if ((input & 0xFFF000) == input) {
|
||||
if (val) *val = input >> 12;
|
||||
if (val) *val = (uint32_t)(input >> 12);
|
||||
if (shift) *shift = true;
|
||||
return true;
|
||||
}
|
||||
@ -1963,7 +1963,7 @@ void ARM64XEmitter::MOVI2R(ARM64Reg Rd, u64 imm, bool optimize)
|
||||
// TODO: Make some more systemic use of MOVN, but this will take care of most cases.
|
||||
// Small negative integer. Use MOVN
|
||||
if (!Is64Bit(Rd) && (imm | 0xFFFF0000) == imm) {
|
||||
MOVN(Rd, ~imm, SHIFT_0);
|
||||
MOVN(Rd, (u32)(~imm), SHIFT_0);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -83,8 +83,8 @@ size_t Write(int fd, const std::string &str) {
|
||||
|
||||
bool WaitUntilReady(int fd, double timeout, bool for_write) {
|
||||
struct timeval tv;
|
||||
tv.tv_sec = floor(timeout);
|
||||
tv.tv_usec = (timeout - floor(timeout)) * 1000000.0;
|
||||
tv.tv_sec = (long)floor(timeout);
|
||||
tv.tv_usec = (long)((timeout - floor(timeout)) * 1000000.0);
|
||||
|
||||
fd_set fds;
|
||||
FD_ZERO(&fds);
|
||||
|
@ -37,7 +37,7 @@ float linearOut(int t, int fadeOutLength) {
|
||||
float ease(float val) {
|
||||
if (val > 1.0f) return 1.0f;
|
||||
if (val < 0.0f) return 0.0f;
|
||||
return ((-cosf(val * PI)) + 1.0f) * 0.5;
|
||||
return (float)(((-cosf(val * PI)) + 1.0f) * 0.5);
|
||||
}
|
||||
|
||||
float ease(int t, int fadeLength)
|
||||
|
@ -148,7 +148,7 @@ void DrawBuffer::RectOutline(float x, float y, float w, float h, uint32_t color,
|
||||
void DrawBuffer::MultiVGradient(float x, float y, float w, float h, GradientStop *stops, int numStops) {
|
||||
for (int i = 0; i < numStops - 1; i++) {
|
||||
float t0 = stops[i].t, t1 = stops[i+1].t;
|
||||
uint32_t c0 = stops[i].t, c1 = stops[i+1].t;
|
||||
uint32_t c0 = stops[i].color, c1 = stops[i+1].color;
|
||||
RectVGradient(x, y + h * t0, w, h * (t1 - t0), c0, c1);
|
||||
}
|
||||
}
|
||||
|
@ -188,8 +188,8 @@ bool UpdateScreenScale(int width, int height) {
|
||||
pixel_in_dps_x = 1.0f / g_dpi_scale_x;
|
||||
pixel_in_dps_y = 1.0f / g_dpi_scale_y;
|
||||
|
||||
int new_dp_xres = width * g_dpi_scale_x;
|
||||
int new_dp_yres = height * g_dpi_scale_y;
|
||||
int new_dp_xres = (int)(width * g_dpi_scale_x);
|
||||
int new_dp_yres = (int)(height * g_dpi_scale_y);
|
||||
|
||||
bool dp_changed = new_dp_xres != dp_xres || new_dp_yres != dp_yres;
|
||||
bool px_changed = pixel_xres != width || pixel_yres != height;
|
||||
|
@ -780,12 +780,12 @@ u32 DiskCachingFileLoaderCache::DetermineMaxBlocks() {
|
||||
}
|
||||
// This might be smaller than what's free, but if they try to launch a second game,
|
||||
// they'll be happier when it can be cached too.
|
||||
return freeBlocksWithFlex;
|
||||
return (u32)freeBlocksWithFlex;
|
||||
}
|
||||
|
||||
// Might be lower than LOWER_BOUND, but that's okay. That means not enough space.
|
||||
// We abandon the idea of flex since there's not enough space free anyway.
|
||||
return freeBlocks;
|
||||
return (u32)freeBlocks;
|
||||
}
|
||||
|
||||
u32 DiskCachingFileLoaderCache::CountCachedFiles() {
|
||||
|
@ -75,10 +75,10 @@ static void CalculateFPS() {
|
||||
|
||||
if (now >= lastFpsTime + 1.0) {
|
||||
double frames = (numVBlanks - lastFpsFrame);
|
||||
actualFps = (actualFlips - lastActualFlips);
|
||||
actualFps = (float)(actualFlips - lastActualFlips);
|
||||
|
||||
fps = frames / (now - lastFpsTime);
|
||||
flips = 60.0 * (double)(gpuStats.numFlips - lastNumFlips) / frames;
|
||||
flips = (float)(60.0 * (double)(gpuStats.numFlips - lastNumFlips) / frames);
|
||||
|
||||
lastFpsFrame = numVBlanks;
|
||||
lastNumFlips = gpuStats.numFlips;
|
||||
@ -105,17 +105,17 @@ static void CalculateFPS() {
|
||||
|
||||
// TODO: Also average actualFps
|
||||
void __DisplayGetFPS(float *out_vps, float *out_fps, float *out_actual_fps) {
|
||||
*out_vps = fps;
|
||||
*out_vps = (float)fps;
|
||||
*out_fps = flips;
|
||||
*out_actual_fps = actualFps;
|
||||
}
|
||||
|
||||
void __DisplayGetVPS(float *out_vps) {
|
||||
*out_vps = fps;
|
||||
*out_vps = (float)fps;
|
||||
}
|
||||
|
||||
void __DisplayGetAveragedFPS(float *out_vps, float *out_fps) {
|
||||
float avg = 0.0;
|
||||
double avg = 0.0;
|
||||
if (fpsHistoryValid > 0) {
|
||||
for (int i = 0; i < fpsHistoryValid; ++i) {
|
||||
avg += fpsHistory[i];
|
||||
@ -123,7 +123,7 @@ void __DisplayGetAveragedFPS(float *out_vps, float *out_fps) {
|
||||
avg /= (double)fpsHistoryValid;
|
||||
}
|
||||
|
||||
*out_vps = *out_fps = avg;
|
||||
*out_vps = *out_fps = (float)avg;
|
||||
}
|
||||
|
||||
int __DisplayGetFlipCount() {
|
||||
@ -147,7 +147,7 @@ uint64_t DisplayFrameStartTicks() {
|
||||
}
|
||||
|
||||
uint32_t __DisplayGetCurrentHcount() {
|
||||
const int ticksIntoFrame = CoreTiming::GetTicks() - frameStartTicks;
|
||||
const int ticksIntoFrame = (int)(CoreTiming::GetTicks() - frameStartTicks);
|
||||
const int ticksPerVblank = CoreTiming::GetClockFrequencyHz() / 60 / hCountPerVblank;
|
||||
// Can't seem to produce a 0 on real hardware, offsetting by 1 makes things look right.
|
||||
return 1 + (ticksIntoFrame / ticksPerVblank);
|
||||
@ -279,7 +279,7 @@ int DisplayCalculateFrameSkip() {
|
||||
int frameSkipNum;
|
||||
if (g_Config.iFrameSkipType == 1) {
|
||||
// Calculate the frames to skip dynamically using the set percentage of the current fps
|
||||
frameSkipNum = ceil(flips * (static_cast<double>(g_Config.iFrameSkip) / 100.00));
|
||||
frameSkipNum = (int)ceil(flips * (static_cast<double>(g_Config.iFrameSkip) / 100.00));
|
||||
} else {
|
||||
// Use the set number of frames to skip
|
||||
frameSkipNum = g_Config.iFrameSkip;
|
||||
|
@ -161,7 +161,7 @@ public:
|
||||
inline void Step();
|
||||
|
||||
int GetHeight() const {
|
||||
return height_ > (s64)PSP_SAS_ENVELOPE_HEIGHT_MAX ? PSP_SAS_ENVELOPE_HEIGHT_MAX : height_;
|
||||
return (int)(height_ > (s64)PSP_SAS_ENVELOPE_HEIGHT_MAX ? PSP_SAS_ENVELOPE_HEIGHT_MAX : height_);
|
||||
}
|
||||
bool NeedsKeyOn() const {
|
||||
return state_ == STATE_KEYON;
|
||||
|
@ -656,12 +656,12 @@ void JitBlockCache::ComputeStats(BlockCacheStats &bcStats) const {
|
||||
bcStats.maxBloatBlock = b->originalAddress;
|
||||
}
|
||||
totalBloat += bloat;
|
||||
bcStats.bloatMap[bloat] = b->originalAddress;
|
||||
bcStats.bloatMap[(float)bloat] = b->originalAddress;
|
||||
}
|
||||
bcStats.numBlocks = num_blocks_;
|
||||
bcStats.minBloat = minBloat;
|
||||
bcStats.maxBloat = maxBloat;
|
||||
bcStats.avgBloat = totalBloat / (double)num_blocks_;
|
||||
bcStats.minBloat = (float)minBloat;
|
||||
bcStats.maxBloat = (float)maxBloat;
|
||||
bcStats.avgBloat = (float)(totalBloat / (double)num_blocks_);
|
||||
}
|
||||
|
||||
JitBlockDebugInfo JitBlockCache::GetBlockDebugInfo(int blockNum) const {
|
||||
|
@ -634,7 +634,7 @@ namespace MIPSInt
|
||||
case 20: d[i] = powf(2.0f, s[i]); break; //vexp2
|
||||
case 21: d[i] = logf(s[i])/log(2.0f); break; //vlog2
|
||||
case 22: d[i] = USE_VPFU_SQRT ? vfpu_sqrt(s[i]) : fabsf(sqrtf(s[i])); break; //vsqrt
|
||||
case 23: d[i] = asinf(s[i]) / M_PI_2; break; //vasin
|
||||
case 23: d[i] = (float)(asinf(s[i]) / M_PI_2); break; //vasin
|
||||
case 24: d[i] = -1.0f / s[i]; break; // vnrcp
|
||||
case 26: { d[i] = -vfpu_sin(s[i]); } break; // vnsin
|
||||
case 28: d[i] = 1.0f / powf(2.0, s[i]); break; // vrexp2
|
||||
|
@ -832,7 +832,7 @@ static inline uint32_t mant_mul(uint32_t a, uint32_t b) {
|
||||
if (m & 0x007FFFFF) {
|
||||
m += 0x01437000;
|
||||
}
|
||||
return m >> 23;
|
||||
return (uint32_t)(m >> 23);
|
||||
}
|
||||
|
||||
float vfpu_rsqrt(float a) {
|
||||
|
@ -55,7 +55,7 @@ extern float vfpu_cos(float);
|
||||
extern void vfpu_sincos(float, float&, float&);
|
||||
|
||||
inline float vfpu_asin(float angle) {
|
||||
return asinf(angle) / M_PI_2;
|
||||
return (float)(asinf(angle) / M_PI_2);
|
||||
}
|
||||
|
||||
inline float vfpu_clamp(float v, float min, float max) {
|
||||
|
@ -181,10 +181,12 @@ void Jit::GenerateFixedCode(JitOptions &jo) {
|
||||
#if PPSSPP_ARCH(X86)
|
||||
ADD(32, R(EAX), ImmPtr(GetBasePtr()));
|
||||
#elif PPSSPP_ARCH(AMD64)
|
||||
if (jo.reserveR15ForAsm)
|
||||
if (jo.reserveR15ForAsm) {
|
||||
ADD(64, R(RAX), R(JITBASEREG));
|
||||
else
|
||||
ADD(64, R(EAX), Imm32(jitbase));
|
||||
} else {
|
||||
// See above, reserveR15ForAsm is used when above 0x7FFFFFFF.
|
||||
ADD(64, R(EAX), Imm32((u32)jitbase));
|
||||
}
|
||||
#endif
|
||||
JMPptr(R(EAX));
|
||||
SetJumpTarget(notfound);
|
||||
|
@ -118,7 +118,7 @@ bool HandleFault(uintptr_t hostAddress, void *ctx) {
|
||||
|
||||
// OK, a guest executable did a bad access. Take care of it.
|
||||
|
||||
uint32_t guestAddress = hostAddress - baseAddress;
|
||||
uint32_t guestAddress = (uint32_t)(hostAddress - baseAddress);
|
||||
|
||||
// TODO: Share the struct between the various analyzers, that will allow us to share most of
|
||||
// the implementations here.
|
||||
@ -173,7 +173,7 @@ bool HandleFault(uintptr_t hostAddress, void *ctx) {
|
||||
// TODO: Do the other archs and platforms.
|
||||
#if PPSSPP_ARCH(AMD64) && PPSSPP_PLATFORM(WINDOWS)
|
||||
// We know which register the address is in, look in Asm.cpp.
|
||||
targetAddr = context->Rax;
|
||||
targetAddr = (uint32_t)context->Rax;
|
||||
#endif
|
||||
Core_ExecException(targetAddr, currentMIPS->pc, ExecExceptionType::JUMP);
|
||||
// Redirect execution to a crash handler that will switch to CoreState::CORE_RUNTIME_ERROR immediately.
|
||||
|
@ -120,14 +120,14 @@ void DecodeBitMasks(int immN, int imms, int immr, uint64_t *tmask, uint64_t *wma
|
||||
// if len < 1 then ReservedValue();
|
||||
// assert M >= (1 << len);
|
||||
// Determine S, R and S - R parameters
|
||||
int levels = Ones(len);
|
||||
int levels = (int)Ones(len);
|
||||
uint32_t S = imms & levels;
|
||||
uint32_t R = immr & levels;
|
||||
int diff = S - R; // 6-bit subtract with borrow
|
||||
int esize = 1 << len;
|
||||
int d = diff & Ones(len - 1);
|
||||
uint32_t welem = Ones(S + 1);
|
||||
uint32_t telem = Ones(d + 1);
|
||||
uint32_t welem = (uint32_t)Ones(S + 1);
|
||||
uint32_t telem = (uint32_t)Ones(d + 1);
|
||||
if (wmask) {
|
||||
uint64_t rotated = ROR(welem, R, esize);
|
||||
*wmask = Replicate(rotated, esize);
|
||||
|
@ -129,7 +129,7 @@ bool RunTests() {
|
||||
// Run the emu until the test exits
|
||||
INFO_LOG(SYSTEM, "Test: Entering runloop.");
|
||||
while (true) {
|
||||
int blockTicks = usToCycles(1000000 / 10);
|
||||
int blockTicks = (int)usToCycles(1000000 / 10);
|
||||
while (coreState == CORE_RUNNING) {
|
||||
PSP_RunLoopFor(blockTicks);
|
||||
}
|
||||
|
@ -202,7 +202,7 @@ bool RunAutoTest(HeadlessHost *headlessHost, CoreParameter &coreParameter, bool
|
||||
coreState = coreParameter.startBreak ? CORE_STEPPING : CORE_RUNNING;
|
||||
while (coreState == CORE_RUNNING || coreState == CORE_STEPPING)
|
||||
{
|
||||
int blockTicks = usToCycles(1000000 / 10);
|
||||
int blockTicks = (int)usToCycles(1000000 / 10);
|
||||
PSP_RunLoopFor(blockTicks);
|
||||
|
||||
// If we were rendering, this might be a nice time to do something about it.
|
||||
@ -319,7 +319,7 @@ int main(int argc, const char* argv[])
|
||||
} else if (!strncmp(argv[i], "--screenshot=", strlen("--screenshot=")) && strlen(argv[i]) > strlen("--screenshot="))
|
||||
screenshotFilename = argv[i] + strlen("--screenshot=");
|
||||
else if (!strncmp(argv[i], "--timeout=", strlen("--timeout=")) && strlen(argv[i]) > strlen("--timeout="))
|
||||
timeout = strtod(argv[i] + strlen("--timeout="), NULL);
|
||||
timeout = (float)strtod(argv[i] + strlen("--timeout="), NULL);
|
||||
else if (!strncmp(argv[i], "--debugger=", strlen("--debugger=")) && strlen(argv[i]) > strlen("--debugger="))
|
||||
debuggerPort = (int)strtoul(argv[i] + strlen("--debugger="), NULL, 10);
|
||||
else if (!strcmp(argv[i], "--teamcity"))
|
||||
|
@ -15,7 +15,7 @@
|
||||
static const u8 *prevStart = NULL;
|
||||
|
||||
bool CheckLast(Gen::XEmitter &emit, const char *comp) {
|
||||
auto vec = DisassembleX86(prevStart, emit.GetCodePointer() - prevStart);
|
||||
auto vec = DisassembleX86(prevStart, (int)(emit.GetCodePointer() - prevStart));
|
||||
EXPECT_EQ_STR(vec[0], std::string(comp));
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user