]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
addrdiff
authorToni Wilen <twilen@winuae.net>
Sun, 1 Jan 2023 14:00:19 +0000 (16:00 +0200)
committerToni Wilen <twilen@winuae.net>
Sun, 1 Jan 2023 14:00:19 +0000 (16:00 +0200)
custom.cpp
od-win32/blkdev_win32_spti.cpp
od-win32/clipboard_win32.cpp
od-win32/direct3d.cpp
od-win32/direct3d11.cpp
od-win32/screenshot.cpp

index ee5a46c3c863df5784532a23793352365a5e7bee..0293e05c402e0265c2ecf8f1b214dea27fba22e9 100644 (file)
@@ -10318,7 +10318,7 @@ static uae_u16 sprite_fetch(struct sprite *s, uaecptr pt, int hpos, int slot, in
        }
 #endif
 #ifdef DEBUGGER
-       int num = (int)(s - &spr[0]);
+       int num = addrdiff(s, &spr[0]);
        if (debug_dma) {
                record_dma_read(num * 8 + 0x140 + mode * 4 + slot * 2, pt, hpos, vpos, DMARECORD_SPRITE, num);
        }
index b89c5b1af383eeb732981d114bb15deb750e2c22..03e0be75135810782bcfcf42b728d784a6078314 100644 (file)
@@ -77,7 +77,7 @@ static int getunitnum (struct dev_info_spti *di)
 {
        if (!di)
                return -1;
-       int idx = (int)(di - &dev_info[0]);
+       int idx = addrdiff(di, &dev_info[0]);
        for (int i = 0; i < MAX_TOTAL_SCSI_DEVICES; i++) {
                if (unittable[i] - 1 == idx)
                        return i;
index 4cfc29d4a251c0aec9d341ee3dd9dc258e327405..2ccaec902664568922f8ec7241e734f8f16f35ee 100644 (file)
@@ -415,7 +415,7 @@ static void to_iff_ilbm(TrapContext *ctx, HBITMAP hbmp)
                }
        }
 
-       tsize = (int)(p - iff - 8);
+       tsize = addrdiff(p, iff) - 8;
        p = iff + 4;
        p[0] = tsize >> 24;
        p[1] = tsize >> 16;
index 4a04b8daf127f1a4ff67c4913ca2827e6ee19f45..5b0a4af3b94c22f303629e4c2d599776f7d861bc 100644 (file)
@@ -1949,7 +1949,7 @@ static int createmasktexture (struct d3dstruct *d3d, const TCHAR *filename, stru
        D3DXIMAGE_INFO dinfo;
        TCHAR tmp[MAX_DPATH];
        int maskwidth, maskheight;
-       int idx = (int)(sd - &d3d->shaders[0]);
+       int idx = addrdiff(sd, &d3d->shaders[0]);
 
        if (filename[0] == 0)
                return 0;
index 8c50226d288caf45c213455ab1c7066636e6e712..4ede01025270d5dc2af1eb6cfee36a46971c4afa 100644 (file)
@@ -2134,7 +2134,7 @@ static bool allocshadertex(struct d3d11struct *d3d, struct shadertex *t, int w,
 
 static bool allocextratextures(struct d3d11struct *d3d, struct shaderdata11 *s, int w, int h)
 {
-       int scnt = (int)(s - &d3d->shaders[0]);
+       int scnt = addrdiff(s, &d3d->shaders[0]);
        if (!allocshadertex(d3d, &s->lpWorkTexture1, w, h, scnt))
                return false;
        if (!allocshadertex(d3d, &s->lpWorkTexture2, w, h, scnt))
index da218f44356dd108618dcc6e20d11beafa7f4784..aefe9d362f16bc7daec5db086198b763bce9353d 100644 (file)
@@ -983,7 +983,7 @@ static int saveiff(FILE *fp, bool alpha)
                }
        }
 
-       int tsize = (int)(p - iff - 8);
+       int tsize = addrdiff(p, iff) - 8;
        p = iff + 4;
        p[0] = tsize >> 24;
        p[1] = tsize >> 16;