summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2026-02-04 16:54:29 +1100
committer Vas Crabb <vas@vastheman.com>2026-02-04 16:54:29 +1100
commitbb5a4f4c7848db43c9ba89706b8600ddfd23cc03 (patch)
tree958e9ed75941e5c327692dbc5e98175fc6d530ae /src
parentda5e44f60720f18c21731d83d26627099e82fe49 (diff)
emu/romentry.h: constexpr at namespace scope implies static for variables and inline for functions; util/palette.h: Don't use reserved _Names.
Diffstat (limited to 'src')
-rw-r--r--src/emu/romentry.h104
-rw-r--r--src/lib/util/palette.h24
2 files changed, 64 insertions, 64 deletions
diff --git a/src/emu/romentry.h b/src/emu/romentry.h
index 56bb6cd2cd5..9ec56c26443 100644
--- a/src/emu/romentry.h
+++ b/src/emu/romentry.h
@@ -45,76 +45,76 @@ enum
// ----- per-region constants -----
-static constexpr u32 ROMREGION_WIDTHMASK = 0x00000300; // native width of region, as power of 2
-static constexpr u32 ROMREGION_8BIT = 0x00000000; // (non-CPU regions only)
-static constexpr u32 ROMREGION_16BIT = 0x00000100;
-static constexpr u32 ROMREGION_32BIT = 0x00000200;
-static constexpr u32 ROMREGION_64BIT = 0x00000300;
+constexpr u32 ROMREGION_WIDTHMASK = 0x00000300; // native width of region, as power of 2
+constexpr u32 ROMREGION_8BIT = 0x00000000; // (non-CPU regions only)
+constexpr u32 ROMREGION_16BIT = 0x00000100;
+constexpr u32 ROMREGION_32BIT = 0x00000200;
+constexpr u32 ROMREGION_64BIT = 0x00000300;
-static constexpr u32 ROMREGION_ENDIANMASK = 0x00000400; // endianness of the region
-static constexpr u32 ROMREGION_LE = 0x00000000; // (non-CPU regions only)
-static constexpr u32 ROMREGION_BE = 0x00000400;
+constexpr u32 ROMREGION_ENDIANMASK = 0x00000400; // endianness of the region
+constexpr u32 ROMREGION_LE = 0x00000000; // (non-CPU regions only)
+constexpr u32 ROMREGION_BE = 0x00000400;
-static constexpr u32 ROMREGION_INVERTMASK = 0x00000800; // invert the bits of the region
-static constexpr u32 ROMREGION_NOINVERT = 0x00000000;
-static constexpr u32 ROMREGION_INVERT = 0x00000800;
+constexpr u32 ROMREGION_INVERTMASK = 0x00000800; // invert the bits of the region
+constexpr u32 ROMREGION_NOINVERT = 0x00000000;
+constexpr u32 ROMREGION_INVERT = 0x00000800;
-static constexpr u32 ROMREGION_ERASEMASK = 0x00002000; // erase the region before loading
-static constexpr u32 ROMREGION_NOERASE = 0x00000000;
-static constexpr u32 ROMREGION_ERASE = 0x00002000;
+constexpr u32 ROMREGION_ERASEMASK = 0x00002000; // erase the region before loading
+constexpr u32 ROMREGION_NOERASE = 0x00000000;
+constexpr u32 ROMREGION_ERASE = 0x00002000;
-static constexpr u32 ROMREGION_DATATYPEMASK = 0x00004000; // type of region (ROM versus disk)
-static constexpr u32 ROMREGION_DATATYPEROM = 0x00000000;
-static constexpr u32 ROMREGION_DATATYPEDISK = 0x00004000;
+constexpr u32 ROMREGION_DATATYPEMASK = 0x00004000; // type of region (ROM versus disk)
+constexpr u32 ROMREGION_DATATYPEROM = 0x00000000;
+constexpr u32 ROMREGION_DATATYPEDISK = 0x00004000;
-static constexpr u32 ROMREGION_ERASEVALMASK = 0x00ff0000; // value to erase the region to
-inline constexpr u32 ROMREGION_ERASEVAL(u8 x) { return (u32(x) << 16) | ROMREGION_ERASE; }
-static constexpr u32 ROMREGION_ERASE00 = ROMREGION_ERASEVAL(0);
-static constexpr u32 ROMREGION_ERASEFF = ROMREGION_ERASEVAL(0xff);
+constexpr u32 ROMREGION_ERASEVALMASK = 0x00ff0000; // value to erase the region to
+constexpr u32 ROMREGION_ERASEVAL(u8 x) { return (u32(x) << 16) | ROMREGION_ERASE; }
+constexpr u32 ROMREGION_ERASE00 = ROMREGION_ERASEVAL(0);
+constexpr u32 ROMREGION_ERASEFF = ROMREGION_ERASEVAL(0xff);
// ----- per-ROM constants -----
-static constexpr u32 DISK_READONLYMASK = 0x00000010; // is the disk read-only?
-static constexpr u32 DISK_READWRITE = 0x00000000;
-static constexpr u32 DISK_READONLY = 0x00000010;
+constexpr u32 DISK_READONLYMASK = 0x00000010; // is the disk read-only?
+constexpr u32 DISK_READWRITE = 0x00000000;
+constexpr u32 DISK_READONLY = 0x00000010;
-static constexpr u32 ROM_OPTIONALMASK = 0x00000020; // optional - won't hurt if it's not there
-static constexpr u32 ROM_REQUIRED = 0x00000000;
+constexpr u32 ROM_OPTIONALMASK = 0x00000020; // optional - won't hurt if it's not there
+constexpr u32 ROM_REQUIRED = 0x00000000;
[[deprecated("use image devices, slot devices or BIOS options for truly optional files")]]
-static constexpr u32 ROM_OPTIONAL = 0x00000020;
+constexpr u32 ROM_OPTIONAL = 0x00000020;
-static constexpr u32 ROM_REVERSEMASK = 0x00000040; // reverse the byte order within a group
-static constexpr u32 ROM_NOREVERSE = 0x00000000;
-static constexpr u32 ROM_REVERSE = 0x00000040;
+constexpr u32 ROM_REVERSEMASK = 0x00000040; // reverse the byte order within a group
+constexpr u32 ROM_NOREVERSE = 0x00000000;
+constexpr u32 ROM_REVERSE = 0x00000040;
-static constexpr u32 ROM_INHERITFLAGSMASK = 0x00000080; // inherit all flags from previous definition
-static constexpr u32 ROM_INHERITFLAGS = 0x00000080;
+constexpr u32 ROM_INHERITFLAGSMASK = 0x00000080; // inherit all flags from previous definition
+constexpr u32 ROM_INHERITFLAGS = 0x00000080;
-static constexpr u32 ROM_GROUPMASK = 0x00000f00; // load data in groups of this size + 1
-inline constexpr u32 ROM_GROUPSIZE(int n) { return ((n - 1) & 15) << 8; }
-static constexpr u32 ROM_GROUPBYTE = ROM_GROUPSIZE(1);
-static constexpr u32 ROM_GROUPWORD = ROM_GROUPSIZE(2);
-static constexpr u32 ROM_GROUPDWORD = ROM_GROUPSIZE(4);
+constexpr u32 ROM_GROUPMASK = 0x00000f00; // load data in groups of this size + 1
+constexpr u32 ROM_GROUPSIZE(unsigned n) { return ((n - 1) & 15) << 8; }
+constexpr u32 ROM_GROUPBYTE = ROM_GROUPSIZE(1);
+constexpr u32 ROM_GROUPWORD = ROM_GROUPSIZE(2);
+constexpr u32 ROM_GROUPDWORD = ROM_GROUPSIZE(4);
-static constexpr u32 ROM_SKIPMASK = 0x0000f000; // skip this many bytes after each group
-inline constexpr u32 ROM_SKIP(int n) { return (n & 15) << 12; }
-static constexpr u32 ROM_NOSKIP = ROM_SKIP(0);
+constexpr u32 ROM_SKIPMASK = 0x0000f000; // skip this many bytes after each group
+constexpr u32 ROM_SKIP(unsigned n) { return (n & 15) << 12; }
+constexpr u32 ROM_NOSKIP = ROM_SKIP(0);
-static constexpr u32 ROM_BITWIDTHMASK = 0x000f0000; // width of data in bits
-static constexpr u32 ROM_BITWIDTH(int n) { return u32(n & 15) << 16; }
-static constexpr u32 ROM_NIBBLE = ROM_BITWIDTH(4);
-static constexpr u32 ROM_FULLBYTE = ROM_BITWIDTH(8);
+constexpr u32 ROM_BITWIDTHMASK = 0x000f0000; // width of data in bits
+constexpr u32 ROM_BITWIDTH(unsigned n) { return u32(n & 15) << 16; }
+constexpr u32 ROM_NIBBLE = ROM_BITWIDTH(4);
+constexpr u32 ROM_FULLBYTE = ROM_BITWIDTH(8);
-static constexpr u32 ROM_BITSHIFTMASK = 0x00f00000; // left-shift count for the bits */
-inline constexpr u32 ROM_BITSHIFT(int n) { return u32(n & 15) << 20; }
-static constexpr u32 ROM_NOSHIFT = ROM_BITSHIFT(0);
-static constexpr u32 ROM_SHIFT_NIBBLE_LO = ROM_BITSHIFT(0);
-static constexpr u32 ROM_SHIFT_NIBBLE_HI = ROM_BITSHIFT(4);
+constexpr u32 ROM_BITSHIFTMASK = 0x00f00000; // left-shift count for the bits
+constexpr u32 ROM_BITSHIFT(unsigned n) { return u32(n & 15) << 20; }
+constexpr u32 ROM_NOSHIFT = ROM_BITSHIFT(0);
+constexpr u32 ROM_SHIFT_NIBBLE_LO = ROM_BITSHIFT(0);
+constexpr u32 ROM_SHIFT_NIBBLE_HI = ROM_BITSHIFT(4);
-static constexpr u32 ROM_BIOSFLAGSMASK = 0xff000000; // only loaded if value matches device bios value
-inline constexpr u32 ROM_BIOS(int n) { return u32((n + 1) & 255) << 24; }
+constexpr u32 ROM_BIOSFLAGSMASK = 0xff000000; // only loaded if value matches device BIOS value
+constexpr u32 ROM_BIOS(unsigned n) { return u32((n + 1) & 255) << 24; }
-static constexpr u32 ROM_INHERITEDFLAGS = ROM_GROUPMASK | ROM_SKIPMASK | ROM_REVERSEMASK | ROM_BITWIDTHMASK | ROM_BITSHIFTMASK | ROM_BIOSFLAGSMASK;
+constexpr u32 ROM_INHERITEDFLAGS = ROM_GROUPMASK | ROM_SKIPMASK | ROM_REVERSEMASK | ROM_BITWIDTHMASK | ROM_BITSHIFTMASK | ROM_BIOSFLAGSMASK;
// ----- start/stop macros -----
diff --git a/src/lib/util/palette.h b/src/lib/util/palette.h
index ce5c92d45a5..38aede5e8f5 100644
--- a/src/lib/util/palette.h
+++ b/src/lib/util/palette.h
@@ -228,16 +228,16 @@ private:
// palexpand - expand a palette value to 8 bits
//-------------------------------------------------
-template<int _NumBits>
+template <int NumBits>
constexpr uint8_t palexpand(uint8_t bits)
{
- if (_NumBits == 1) { return (bits & 1) ? 0xff : 0x00; }
- if (_NumBits == 2) { bits &= 3; return (bits << 6) | (bits << 4) | (bits << 2) | bits; }
- if (_NumBits == 3) { bits &= 7; return (bits << 5) | (bits << 2) | (bits >> 1); }
- if (_NumBits == 4) { bits &= 0xf; return (bits << 4) | bits; }
- if (_NumBits == 5) { bits &= 0x1f; return (bits << 3) | (bits >> 2); }
- if (_NumBits == 6) { bits &= 0x3f; return (bits << 2) | (bits >> 4); }
- if (_NumBits == 7) { bits &= 0x7f; return (bits << 1) | (bits >> 6); }
+ if (NumBits == 1) { return (bits & 0x01) ? 0xff : 0x00; }
+ if (NumBits == 2) { bits &= 0x03; return (bits << 6) | (bits << 4) | (bits << 2) | bits; }
+ if (NumBits == 3) { bits &= 0x07; return (bits << 5) | (bits << 2) | (bits >> 1); }
+ if (NumBits == 4) { bits &= 0x0f; return (bits << 4) | bits; }
+ if (NumBits == 5) { bits &= 0x1f; return (bits << 3) | (bits >> 2); }
+ if (NumBits == 6) { bits &= 0x3f; return (bits << 2) | (bits >> 4); }
+ if (NumBits == 7) { bits &= 0x7f; return (bits << 1) | (bits >> 6); }
return bits;
}
@@ -260,16 +260,16 @@ constexpr uint8_t pal7bit(uint8_t bits) { return palexpand<7>(bits); }
// RGB
//-------------------------------------------------
-template<int _RBits, int _GBits, int _BBits>
+template <int RBits, int GBits, int BBits>
constexpr rgb_t rgbexpand(uint32_t data, uint8_t rshift, uint8_t gshift, uint8_t bshift)
{
- return rgb_t(palexpand<_RBits>(data >> rshift), palexpand<_GBits>(data >> gshift), palexpand<_BBits>(data >> bshift));
+ return rgb_t(palexpand<RBits>(data >> rshift), palexpand<GBits>(data >> gshift), palexpand<BBits>(data >> bshift));
}
-template<int _ABits, int _RBits, int _GBits, int _BBits>
+template <int ABits, int RBits, int GBits, int BBits>
constexpr rgb_t argbexpand(uint32_t data, uint8_t ashift, uint8_t rshift, uint8_t gshift, uint8_t bshift)
{
- return rgb_t(palexpand<_ABits>(data >> ashift), palexpand<_RBits>(data >> rshift), palexpand<_GBits>(data >> gshift), palexpand<_BBits>(data >> bshift));
+ return rgb_t(palexpand<ABits>(data >> ashift), palexpand<RBits>(data >> rshift), palexpand<GBits>(data >> gshift), palexpand<BBits>(data >> bshift));
}