summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/romload.c
diff options
context:
space:
mode:
author Aaron Giles <aaron@aarongiles.com>2009-01-17 23:03:17 +0000
committer Aaron Giles <aaron@aarongiles.com>2009-01-17 23:03:17 +0000
commiteb8366c740e8466b5dfdd6ef40e2b794e9fe8f99 (patch)
tree40576ce0519d13beec04affa2e33f7d2bf5d80e3 /src/emu/romload.c
parent79dbafbd2f08279b309e9f8ba31bbbfe3c9355db (diff)
Added new #define ENDIANNESS_NATIVE, which maps to either ENDIANNESS_LITTLE
or ENDIANNESS_BIG based on the LSB_FIRST definition. Unlink LSB_FIRST, ENDIANNESS_NATIVE always exists and can be used in expressions without invoking the preprocessor. Added macro ENDIAN_VALUE_LE_BE() which selects one of two values based on the endianness passed in. Also added NATIVE_ENDIAN_VALUE_LE_BE() which calls ENDIAN_VALUE_LE_BE with ENDIANNESS_NATIVE. Updated a number of drivers and call sites to use these macros in favor of #ifdef LSB_FIRST.
Diffstat (limited to 'src/emu/romload.c')
-rw-r--r--src/emu/romload.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/emu/romload.c b/src/emu/romload.c
index b2d8f457f36..1e49104f1a1 100644
--- a/src/emu/romload.c
+++ b/src/emu/romload.c
@@ -613,12 +613,12 @@ static void region_post_process(rom_load_data *romdata, const char *rgntag)
UINT32 regionlength = memory_region_length(romdata->machine, rgntag);
UINT32 regionflags = memory_region_flags(romdata->machine, rgntag);
UINT8 *regionbase = memory_region(romdata->machine, rgntag);
- int littleendian = ((regionflags & ROMREGION_ENDIANMASK) == ROMREGION_LE);
+ int endianness = ((regionflags & ROMREGION_ENDIANMASK) == ROMREGION_LE) ? ENDIANNESS_LITTLE : ENDIANNESS_BIG;
int datawidth = 1 << ((regionflags & ROMREGION_WIDTHMASK) >> 8);
UINT8 *base;
int i, j;
- LOG(("+ datawidth=%d little=%d\n", datawidth, littleendian));
+ LOG(("+ datawidth=%d little=%d\n", datawidth, endianness == ENDIANNESS_LITTLE));
/* if the region is inverted, do that now */
if (regionflags & ROMREGION_INVERTMASK)
@@ -629,11 +629,7 @@ static void region_post_process(rom_load_data *romdata, const char *rgntag)
}
/* swap the endianness if we need to */
-#ifdef LSB_FIRST
- if (datawidth > 1 && !littleendian)
-#else
- if (datawidth > 1 && littleendian)
-#endif
+ if (datawidth > 1 && endianness != ENDIANNESS_NATIVE)
{
LOG(("+ Byte swapping region\n"));
for (i = 0, base = regionbase; i < regionlength; i += datawidth)