Fixed three instances of undefined behavior.

This commit is contained in:
OBattler
2022-02-20 20:30:20 +01:00
parent 3b5be8b619
commit f19aaa14ae
3 changed files with 4 additions and 4 deletions

View File

@@ -9,7 +9,7 @@
All registers must have been written back or discarded. All registers must have been written back or discarded.
This should be used when calling external functions that may change any emulated This should be used when calling external functions that may change any emulated
registers.*/ registers.*/
#define UOP_TYPE_BARRIER (1 << 31) #define UOP_TYPE_BARRIER (1u << 31)
/*uOP is a barrier. All previous uOPs must have completed before this one executes. /*uOP is a barrier. All previous uOPs must have completed before this one executes.
All registers must have been written back, but do not have to be discarded. All registers must have been written back, but do not have to be discarded.

View File

@@ -222,7 +222,7 @@ find_best_interrupt(pic_t *dev)
if (dev == &pic2) if (dev == &pic2)
intr += 8; intr += 8;
if (cpu_fast_off_flags & (1 << intr)) if (cpu_fast_off_flags & (1u << intr))
cpu_fast_off_count = cpu_fast_off_val + 1; cpu_fast_off_count = cpu_fast_off_val + 1;
} }

View File

@@ -936,11 +936,11 @@ svga_init(const device_t *info, svga_t *svga, void *p, int memsize,
svga->dispontime = 1000ull << 32; svga->dispontime = 1000ull << 32;
svga->dispofftime = 1000ull << 32; svga->dispofftime = 1000ull << 32;
svga->bpp = 8; svga->bpp = 8;
svga->vram = malloc(memsize); svga->vram = calloc(memsize, 1);
svga->vram_max = memsize; svga->vram_max = memsize;
svga->vram_display_mask = svga->vram_mask = memsize - 1; svga->vram_display_mask = svga->vram_mask = memsize - 1;
svga->decode_mask = 0x7fffff; svga->decode_mask = 0x7fffff;
svga->changedvram = malloc(memsize >> 12); svga->changedvram = calloc(memsize >> 12, 1);
svga->recalctimings_ex = recalctimings_ex; svga->recalctimings_ex = recalctimings_ex;
svga->video_in = video_in; svga->video_in = video_in;
svga->video_out = video_out; svga->video_out = video_out;