From: notaz Date: Thu, 15 Sep 2022 21:03:40 +0000 (+0300) Subject: don't cast between long and pointers for win64 X-Git-Tag: r24l~380 X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2d724e28a974472f4d24dc71f8cd489fbcd27869;p=pcsx_rearmed.git don't cast between long and pointers for win64 long is 32 bit there --- diff --git a/frontend/main.c b/frontend/main.c index 6be005a6..d846d3ce 100644 --- a/frontend/main.c +++ b/frontend/main.c @@ -998,7 +998,7 @@ void *SysLoadLibrary(const char *lib) { tmp++; for (i = 0; i < ARRAY_SIZE(builtin_plugins); i++) if (strcmp(tmp, builtin_plugins[i]) == 0) - return (void *)(long)(PLUGIN_DL_BASE + builtin_plugin_ids[i]); + return (void *)(uintptr_t)(PLUGIN_DL_BASE + builtin_plugin_ids[i]); } #if !defined(_WIN32) && !defined(NO_DYLIB) @@ -1013,7 +1013,7 @@ void *SysLoadLibrary(const char *lib) { } void *SysLoadSym(void *lib, const char *sym) { - unsigned int plugid = (unsigned int)(long)lib; + unsigned int plugid = (unsigned int)(uintptr_t)lib; if (PLUGIN_DL_BASE <= plugid && plugid < PLUGIN_DL_BASE + ARRAY_SIZE(builtin_plugins)) return plugin_link(plugid - PLUGIN_DL_BASE, sym); @@ -1036,7 +1036,7 @@ const char *SysLibError() { } void SysCloseLibrary(void *lib) { - unsigned int plugid = (unsigned int)(long)lib; + unsigned int plugid = (unsigned int)(uintptr_t)lib; if (PLUGIN_DL_BASE <= plugid && plugid < PLUGIN_DL_BASE + ARRAY_SIZE(builtin_plugins)) return; diff --git a/libpcsxcore/psxmem.c b/libpcsxcore/psxmem.c index 9bb3760a..5d9b1616 100644 --- a/libpcsxcore/psxmem.c +++ b/libpcsxcore/psxmem.c @@ -71,13 +71,13 @@ retry: /* if (is_fixed) flags |= MAP_FIXED; */ - req = (void *)addr; + req = (void *)(uintptr_t)addr; ret = mmap(req, size, PROT_READ | PROT_WRITE, flags, -1, 0); if (ret == MAP_FAILED) return ret; } - if (addr != 0 && ret != (void *)addr) { + if (addr != 0 && ret != (void *)(uintptr_t)addr) { SysMessage("psxMap: warning: wanted to map @%08x, got %p\n", addr, ret); @@ -86,14 +86,14 @@ retry: return MAP_FAILED; } - if (((addr ^ (unsigned long)ret) & ~0xff000000l) && try_ < 2) + if (((addr ^ (unsigned long)(uintptr_t)ret) & ~0xff000000l) && try_ < 2) { psxUnmap(ret, size, tag); // try to use similarly aligned memory instead // (recompiler needs this) mask = try_ ? 0xffff : 0xffffff; - addr = ((unsigned long)ret + mask) & ~mask; + addr = ((uintptr_t)ret + mask) & ~mask; try_++; goto retry; } diff --git a/plugins/dfsound/freeze.c b/plugins/dfsound/freeze.c index a400cf7c..51e9fd77 100644 --- a/plugins/dfsound/freeze.c +++ b/plugins/dfsound/freeze.c @@ -187,8 +187,8 @@ static void load_channel(SPUCHAN *d, const SPUCHAN_orig *s, int ch) d->sinc = s->sinc; d->sinc_inv = 0; memcpy(spu.SB + ch * SB_SIZE, s->SB, sizeof(spu.SB[0]) * SB_SIZE); - d->pCurr = (void *)((long)s->iCurr & 0x7fff0); - d->pLoop = (void *)((long)s->iLoop & 0x7fff0); + d->pCurr = (void *)((uintptr_t)s->iCurr & 0x7fff0); + d->pLoop = (void *)((uintptr_t)s->iLoop & 0x7fff0); d->bReverb = s->bReverb; d->iLeftVolume = s->iLeftVolume; d->iRightVolume = s->iRightVolume; @@ -258,7 +258,7 @@ long CALLBACK SPUfreeze(uint32_t ulFreezeMode, SPUFreeze_t * pF, pFO=(SPUOSSFreeze_t *)(pF+1); // store special stuff pFO->spuIrq = spu.regArea[(H_SPUirqAddr - 0x0c00) / 2]; - if(spu.pSpuIrq) pFO->pSpuIrq = (unsigned long)spu.pSpuIrq-(unsigned long)spu.spuMemC; + if(spu.pSpuIrq) pFO->pSpuIrq = spu.pSpuIrq - spu.spuMemC; pFO->spuAddr=spu.spuAddr; if(pFO->spuAddr==0) pFO->spuAddr=0xbaadf00d; @@ -340,8 +340,8 @@ void LoadStateV5(SPUFreeze_t * pF) { load_channel(&spu.s_chan[i],&pFO->s_chan[i],i); - spu.s_chan[i].pCurr+=(unsigned long)spu.spuMemC; - spu.s_chan[i].pLoop+=(unsigned long)spu.spuMemC; + spu.s_chan[i].pCurr+=(uintptr_t)spu.spuMemC; + spu.s_chan[i].pLoop+=(uintptr_t)spu.spuMemC; } } diff --git a/plugins/gpu_neon/psx_gpu/psx_gpu.c b/plugins/gpu_neon/psx_gpu/psx_gpu.c index 51ad152d..85cf89fa 100644 --- a/plugins/gpu_neon/psx_gpu/psx_gpu.c +++ b/plugins/gpu_neon/psx_gpu/psx_gpu.c @@ -14,6 +14,7 @@ #include #include +#include #include #include "common.h" @@ -4016,7 +4017,7 @@ void setup_sprite_untextured_simple(psx_gpu_struct *psx_gpu, s32 x, s32 y, num_width = width; vram_ptr = (void *)vram_ptr16; - if((long)vram_ptr16 & 2) + if((uintptr_t)vram_ptr16 & 2) { *vram_ptr16 = color_32bpp; vram_ptr = (void *)(vram_ptr16 + 1);