From eaa70ae0313eb1135ba63814f07f7e22c766a504 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Sun, 31 Jul 2016 16:41:26 +0200 Subject: [PATCH] cleanup of some conversions (nw) --- src/devices/bus/iq151/minigraf.cpp | 8 ++++---- src/devices/bus/isa/cga.cpp | 4 ++-- src/devices/bus/msx_cart/nomapper.cpp | 2 +- src/devices/cpu/powerpc/ppccom.cpp | 2 +- src/devices/video/polylgcy.cpp | 2 +- src/emu/debug/dvmemory.cpp | 4 ++-- src/frontend/mame/cheat.cpp | 2 +- src/lib/formats/cassimg.cpp | 2 +- src/lib/util/palette.cpp | 4 ++-- 9 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/devices/bus/iq151/minigraf.cpp b/src/devices/bus/iq151/minigraf.cpp index 446ce2c95a0..d95c5a564ce 100644 --- a/src/devices/bus/iq151/minigraf.cpp +++ b/src/devices/bus/iq151/minigraf.cpp @@ -154,10 +154,10 @@ void iq151_minigraf_device::plotter_update(UINT8 control) m_pen = BIT(control, 7); // clamp within range - m_posx = std::max(m_posx, INT16(0)); - m_posx = std::min(m_posx, INT16(PAPER_MAX_X)); - m_posy = std::max(m_posy, INT16(0)); - m_posy = std::min(m_posy, INT16(PAPER_MAX_Y)); + m_posx = std::max(m_posx, 0); + m_posx = std::min(m_posx, PAPER_MAX_X); + m_posy = std::max(m_posy, 0); + m_posy = std::min(m_posy, PAPER_MAX_Y); // if pen is down draws a point if (m_pen) diff --git a/src/devices/bus/isa/cga.cpp b/src/devices/bus/isa/cga.cpp index 622c316969c..028b8cb4ad4 100644 --- a/src/devices/bus/isa/cga.cpp +++ b/src/devices/bus/isa/cga.cpp @@ -349,7 +349,7 @@ void isa8_cga_device::device_start() set_isa_device(); m_vram.resize(m_vram_size); m_isa->install_device(0x3d0, 0x3df, read8_delegate( FUNC(isa8_cga_device::io_read), this ), write8_delegate( FUNC(isa8_cga_device::io_write), this ) ); - m_isa->install_bank(0xb8000, 0xb8000 + std::min(size_t(0x8000),m_vram_size) - 1, "bank_cga", &m_vram[0]); + m_isa->install_bank(0xb8000, 0xb8000 + std::min(0x8000,m_vram_size) - 1, "bank_cga", &m_vram[0]); if(m_vram_size == 0x4000) m_isa->install_bank(0xbc000, 0xbffff, "bank_cga", &m_vram[0]); @@ -1821,7 +1821,7 @@ WRITE8_MEMBER( isa8_ec1841_0002_device::io_write ) read8_delegate( FUNC(isa8_ec1841_0002_device::char_ram_read), this), write8_delegate(FUNC(isa8_ec1841_0002_device::char_ram_write), this) ); } else { - m_isa->install_bank(0xb8000, 0xb8000 + std::min(size_t(0x8000),m_vram_size) - 1, "bank_cga", &m_vram[0]); + m_isa->install_bank(0xb8000, 0xb8000 + std::min(0x8000,m_vram_size) - 1, "bank_cga", &m_vram[0]); if(m_vram_size == 0x4000) m_isa->install_bank(0xbc000, 0xbffff, "bank_cga", &m_vram[0]); } diff --git a/src/devices/bus/msx_cart/nomapper.cpp b/src/devices/bus/msx_cart/nomapper.cpp index 2f31fe937c7..175681e0227 100644 --- a/src/devices/bus/msx_cart/nomapper.cpp +++ b/src/devices/bus/msx_cart/nomapper.cpp @@ -81,7 +81,7 @@ void msx_cart_nomapper::initialize_cartridge() break; } - m_end_address = std::min(m_start_address + size, UINT32(0x10000)); + m_end_address = std::min(m_start_address + size, 0x10000); } READ8_MEMBER(msx_cart_nomapper::read_cart) diff --git a/src/devices/cpu/powerpc/ppccom.cpp b/src/devices/cpu/powerpc/ppccom.cpp index 7611d6d0e25..cb647c20040 100644 --- a/src/devices/cpu/powerpc/ppccom.cpp +++ b/src/devices/cpu/powerpc/ppccom.cpp @@ -409,7 +409,7 @@ inline void ppc_device::set_timebase(UINT64 newtb) inline UINT32 ppc_device::get_decrementer() { INT64 cycles_until_zero = m_dec_zero_cycles - total_cycles(); - cycles_until_zero = std::max(cycles_until_zero, INT64(0)); + cycles_until_zero = std::max(cycles_until_zero, 0); if (!m_tb_divisor) { diff --git a/src/devices/video/polylgcy.cpp b/src/devices/video/polylgcy.cpp index 2971b528781..0d6a872ed6d 100644 --- a/src/devices/video/polylgcy.cpp +++ b/src/devices/video/polylgcy.cpp @@ -332,7 +332,7 @@ legacy_poly_manager *poly_alloc(running_machine &machine, int max_polys, size_t /* allocate triangle work units */ poly->unit_size = (flags & POLYFLAG_ALLOW_QUADS) ? sizeof(quad_work_unit) : sizeof(tri_work_unit); - poly->unit_count = std::min(poly->polygon_count * UNITS_PER_POLY, UINT32(65535)); + poly->unit_count = std::min(poly->polygon_count * UNITS_PER_POLY, 65535U); poly->unit_next = 0; poly->unit = (work_unit **)allocate_array(machine, &poly->unit_size, poly->unit_count); diff --git a/src/emu/debug/dvmemory.cpp b/src/emu/debug/dvmemory.cpp index 3a463a6e56d..51899cdf54f 100644 --- a/src/emu/debug/dvmemory.cpp +++ b/src/emu/debug/dvmemory.cpp @@ -67,7 +67,7 @@ debug_view_memory_source::debug_view_memory_source(const char *name, memory_regi m_length(region.bytes()), m_offsetxor(ENDIAN_VALUE_NE_NNE(region.endianness(), 0, region.bytewidth() - 1)), m_endianness(region.endianness()), - m_prefsize(std::min(region.bytewidth(), UINT8(8))) + m_prefsize(std::min(region.bytewidth(), 8)) { } @@ -556,7 +556,7 @@ void debug_view_memory::recompute() m_bytes_per_chunk *= 2; m_chunks_per_row /= 2; } - m_chunks_per_row = std::max(UINT32(1), m_chunks_per_row); + m_chunks_per_row = std::max(1U, m_chunks_per_row); } // recompute the byte offset based on the most recent expression result diff --git a/src/frontend/mame/cheat.cpp b/src/frontend/mame/cheat.cpp index 4d6df3fb866..13c90f7a283 100644 --- a/src/frontend/mame/cheat.cpp +++ b/src/frontend/mame/cheat.cpp @@ -1359,7 +1359,7 @@ void cheat_manager::frame_update() // set up for accumulating output m_lastline = 0; m_numlines = floor(1.0f / mame_machine_manager::instance()->ui().get_line_height()); - m_numlines = std::min(size_t(m_numlines), m_output.size()); + m_numlines = std::min(m_numlines, m_output.size()); for (auto & elem : m_output) elem.clear(); diff --git a/src/lib/formats/cassimg.cpp b/src/lib/formats/cassimg.cpp index e62d2013ecb..d1b3495e3e8 100644 --- a/src/lib/formats/cassimg.cpp +++ b/src/lib/formats/cassimg.cpp @@ -779,7 +779,7 @@ casserr_t cassette_read_modulated_data(cassette_image *cassette, int channel, do } else { - buffer_length = std::min(length, UINT64(100000)); + buffer_length = std::min(length, 100000); alloc_buffer = (UINT8*)malloc(buffer_length); if (!alloc_buffer) { diff --git a/src/lib/util/palette.cpp b/src/lib/util/palette.cpp index bbee6b321cd..e918bb7adb2 100644 --- a/src/lib/util/palette.cpp +++ b/src/lib/util/palette.cpp @@ -514,8 +514,8 @@ void palette_t::normalize_range(UINT32 start, UINT32 end, int lum_min, int lum_m { rgb_t rgb = m_entry_color[index]; UINT32 y = 299 * rgb.r() + 587 * rgb.g() + 114 * rgb.b(); - ymin = std::min(ymin, INT32(y)); - ymax = std::max(ymax, INT32(y)); + ymin = std::min(ymin, y); + ymax = std::max(ymax, y); } // determine target minimum/maximum