Skip to content

Commit cbc97e5

Browse files
committed
fixed arithmetic on void*, allowed on GCC but illegal by standard
1 parent c34bf54 commit cbc97e5

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/drivers/dingux-sdl/dingoo-video.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -317,9 +317,9 @@ void flip_NNOptimized_AllowOutOfScreen(SDL_Surface *src_surface, SDL_Surface *ds
317317
continue;
318318
}
319319

320-
uint16_t *t = (uint16_t *) (dst_surface->pixels + ((i + y_padding) * ((w2 > RES_HW_SCREEN_HORIZONTAL) ? RES_HW_SCREEN_HORIZONTAL : w2)) * sizeof (uint16_t));
320+
uint16_t *t = static_cast<uint16_t*>(dst_surface->pixels) + ((i + y_padding) * ((w2 > RES_HW_SCREEN_HORIZONTAL) ? RES_HW_SCREEN_HORIZONTAL : w2));
321321
y2 = (i * y_ratio) >> 16;
322-
uint16_t *p = (uint16_t *) (src_surface->pixels + (y2 * w1 + x_padding_ratio) * sizeof (uint16_t));
322+
uint16_t *p = static_cast<uint16_t*>(src_surface->pixels) + (y2 * w1 + x_padding_ratio);
323323
int rat = 0;
324324
for (int j = 0; j < w2; j++) {
325325
if (j >= RES_HW_SCREEN_HORIZONTAL) {
@@ -357,7 +357,7 @@ void flip_NNOptimized_AllowOutOfScreen_NES(uint8_t *nes_px, SDL_Surface *dst_sur
357357
continue;
358358
}
359359

360-
uint16_t *t = (uint16_t *) (dst_surface->pixels + ((i + y_padding) * ((w2 > RES_HW_SCREEN_HORIZONTAL) ? RES_HW_SCREEN_HORIZONTAL : w2)) * sizeof (uint16_t));
360+
uint16_t *t = static_cast<uint16_t*>(dst_surface->pixels) + ((i + y_padding) * ((w2 > RES_HW_SCREEN_HORIZONTAL) ? RES_HW_SCREEN_HORIZONTAL : w2));
361361
y2 = (i * y_ratio) >> 16;
362362
uint8_t *p = (uint8_t *) (nes_px + (y2 * w1 + x_padding_ratio) * sizeof (uint8_t));
363363
int rat = 0;
@@ -408,7 +408,7 @@ void flip_Downscale_LeftRightGaussianFilter_NES(uint8_t *nes_px, SDL_Surface *ds
408408
continue;
409409
}
410410

411-
uint16_t *t = (uint16_t *) (dst_surface->pixels + ((i + y_padding) * ((w2 > RES_HW_SCREEN_HORIZONTAL) ? RES_HW_SCREEN_HORIZONTAL : w2)) * sizeof (uint16_t));
411+
uint16_t *t = static_cast<uint16_t*>(dst_surface->pixels) + ((i + y_padding) * ((w2 > RES_HW_SCREEN_HORIZONTAL) ? RES_HW_SCREEN_HORIZONTAL : w2));
412412
y1 = (i * y_ratio) >> 16;
413413
uint8_t *p = (uint8_t *) (nes_px + (y1 * w1 + x_padding_ratio) * sizeof (uint8_t));
414414
int rat = 0;

0 commit comments

Comments
 (0)