From f96f2555cf8c065b4bfb28224e7fc379b3f38a70 Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Wed, 16 Nov 2022 04:16:52 +1100 Subject: [PATCH] Miscellaneous cleanup: * mame/namcos22.h: Use common helpers for integer manipulation, more appropriate use of inline/static/constexpr. * bus/gio64/newport.cpp: Changed a couple instances of K&R formatting that snuck in to Allman like the rest of the file. * bus/gameboy/gbxfile.h: Added comment about another use of GBX footer "extra data". --- src/devices/bus/gameboy/gbxfile.h | 5 +++++ src/devices/bus/gio64/newport.cpp | 10 +++++++--- src/mame/namco/namcos22.h | 14 +++++++------- 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/src/devices/bus/gameboy/gbxfile.h b/src/devices/bus/gameboy/gbxfile.h index f454c045a6d..0a30a7b25ac 100644 --- a/src/devices/bus/gameboy/gbxfile.h +++ b/src/devices/bus/gameboy/gbxfile.h @@ -32,6 +32,11 @@ Vast Fame VF001 (FourCC 'VF01') additional data: * Command preload value (1 byte). + Kong Feng DSH-GGB81 (FourCC 'GB81') additional data: + * Cartridge/PCB type (1 byte): + - 0x00: DSH-GGB81 + - 0x01: BC-R1616T3P + The list of cartridge type FourCC values here is incomplete. ***************************************************************************/ diff --git a/src/devices/bus/gio64/newport.cpp b/src/devices/bus/gio64/newport.cpp index e72e4639677..8ba637d91db 100644 --- a/src/devices/bus/gio64/newport.cpp +++ b/src/devices/bus/gio64/newport.cpp @@ -913,7 +913,8 @@ void rb2_device::deserialize(FILE *file) uint32_t rb2_device::expand_to_all_lanes(uint32_t src) { - switch (m_draw_depth) { + switch (m_draw_depth) + { case 0: src |= src << 4; src |= src << 8; @@ -2726,7 +2727,8 @@ void newport_base_device::do_setup(void) const int32_t dy = abs(y1 - y2); const uint8_t adrmode = (m_rex3.m_draw_mode0 >> 2) & 7; - if (adrmode >= 0 && adrmode <= 1) { + if (adrmode >= 0 && adrmode <= 1) + { /* quadrant for block or span */ uint8_t quadrant = 0; /* This is purely guessed */ @@ -2746,7 +2748,9 @@ void newport_base_device::do_setup(void) } m_rex3.m_bres_octant_inc1 &= ~(0x7 << 24); m_rex3.m_bres_octant_inc1 |= quadrant << 24; - } else if (adrmode >= 2 && adrmode <= 4) { + } + else if (adrmode >= 2 && adrmode <= 4) + { uint8_t octant; /* octant for line */ /* FIXME: error terms and Bresenham terms */ diff --git a/src/mame/namco/namcos22.h b/src/mame/namco/namcos22.h index dd55adad501..0bf8e45b78d 100644 --- a/src/mame/namco/namcos22.h +++ b/src/mame/namco/namcos22.h @@ -328,15 +328,15 @@ protected: u16 mcuc74_speedup_r(); void mcu_speedup_w(offs_t offset, u16 data, u16 mem_mask = ~0); - inline u8 nthbyte(const u32 *src, int n) { return (src[n / 4] << ((n & 3) * 8)) >> 24; } - inline u16 nthword(const u32 *src, int n) { return (src[n / 2] << ((n & 1) * 16)) >> 16; } + static u8 nthbyte(const u32 *src, int n) { return util::big_endian_cast(src)[n]; } + static u16 nthword(const u32 *src, int n) { return util::big_endian_cast(src)[n];; } - inline s32 signed12(s32 val) { return (val & 0x00000800) ? (s32)(val | 0xfffff000) : val & 0x000007ff; } - inline s32 signed18(s32 val) { return (val & 0x00020000) ? (s32)(val | 0xfffc0000) : val & 0x0001ffff; } - inline s32 signed24(s32 val) { return (val & 0x00800000) ? (s32)(val | 0xff000000) : val & 0x007fffff; } + static constexpr s32 signed12(s32 val) { return util::sext(val, 12); } + static constexpr s32 signed18(s32 val) { return util::sext(val, 18); } + static constexpr s32 signed24(s32 val) { return util::sext(val, 24); } - inline float dspfixed_to_nativefloat(s16 val) { return val / (float)0x7fff; } - float dspfloat_to_nativefloat(u32 val); + static constexpr float dspfixed_to_nativefloat(s16 val) { return val / (float)0x7fff; } + static float dspfloat_to_nativefloat(u32 val); void handle_driving_io(); void handle_coinage(u16 flags);