diff options
author | Miodrag Milanovic <mmicko@gmail.com> | 2016-07-31 16:47:26 +0200 |
---|---|---|
committer | Miodrag Milanovic <mmicko@gmail.com> | 2016-07-31 16:47:26 +0200 |
commit | f127621e13050aad6b455ebfadec5bfdcbdd00d4 (patch) | |
tree | 0601ca3093ab58610f108f93167d344151b2d4e5 | |
parent | eaa70ae0313eb1135ba63814f07f7e22c766a504 (diff) |
made constexprs lower case and used constexpr for returning input value as well for rest of defines in osdcomm.h (nw)
46 files changed, 182 insertions, 182 deletions
diff --git a/src/devices/cpu/arc/arcdasm.cpp b/src/devices/cpu/arc/arcdasm.cpp index 7a525d6cb61..1b7897069de 100644 --- a/src/devices/cpu/arc/arcdasm.cpp +++ b/src/devices/cpu/arc/arcdasm.cpp @@ -194,7 +194,7 @@ static const char *regnames[0x40] = CPU_DISASSEMBLE(arc) { UINT32 op = oprom[0] | (oprom[1] << 8) | (oprom[2] << 16) | (oprom[3] << 24); - op = BIG_ENDIANIZE_INT32(op); + op = big_endianize_int32(op); output = buffer; diff --git a/src/devices/cpu/cubeqcpu/cubedasm.cpp b/src/devices/cpu/cubeqcpu/cubedasm.cpp index 81d7d95c088..bbd1c750361 100644 --- a/src/devices/cpu/cubeqcpu/cubedasm.cpp +++ b/src/devices/cpu/cubeqcpu/cubedasm.cpp @@ -81,7 +81,7 @@ CPU_DISASSEMBLE( cquestsnd ) " ", }; - UINT64 inst = BIG_ENDIANIZE_INT64(*(UINT64 *)oprom); + UINT64 inst = big_endianize_int64(*(UINT64 *)oprom); UINT32 inslow = inst & 0xffffffff; UINT32 inshig = inst >> 32; @@ -185,7 +185,7 @@ CPU_DISASSEMBLE( cquestrot ) "??? " }; - UINT64 inst = BIG_ENDIANIZE_INT64(*(UINT64 *)oprom); + UINT64 inst = big_endianize_int64(*(UINT64 *)oprom); UINT32 inslow = inst & 0xffffffff; UINT32 inshig = inst >> 32; @@ -271,7 +271,7 @@ CPU_DISASSEMBLE( cquestlin ) "BRES ", }; - UINT64 inst = BIG_ENDIANIZE_INT64(*(UINT64 *)oprom); + UINT64 inst = big_endianize_int64(*(UINT64 *)oprom); UINT32 inslow = inst & 0xffffffff; UINT32 inshig = inst >> 32; diff --git a/src/devices/cpu/esrip/esripdsm.cpp b/src/devices/cpu/esrip/esripdsm.cpp index 8e5a01ae792..41f3434d2cd 100644 --- a/src/devices/cpu/esrip/esripdsm.cpp +++ b/src/devices/cpu/esrip/esripdsm.cpp @@ -45,7 +45,7 @@ CPU_DISASSEMBLE( esrip ) }; #endif - UINT64 inst = BIG_ENDIANIZE_INT64(*(UINT64 *)oprom); + UINT64 inst = big_endianize_int64(*(UINT64 *)oprom); UINT32 inst_hi = inst >> 32; UINT32 inst_lo = inst & 0xffffffff; diff --git a/src/devices/cpu/mb86233/mb86233d.cpp b/src/devices/cpu/mb86233/mb86233d.cpp index 6e27c3b4d06..f75053c07ff 100644 --- a/src/devices/cpu/mb86233/mb86233d.cpp +++ b/src/devices/cpu/mb86233/mb86233d.cpp @@ -779,6 +779,6 @@ static unsigned dasm_mb86233(char *buffer, UINT32 opcode ) CPU_DISASSEMBLE( mb86233 ) { UINT32 op = *(UINT32 *)oprom; - op = LITTLE_ENDIANIZE_INT32(op); + op = little_endianize_int32(op); return dasm_mb86233(buffer, op); } diff --git a/src/devices/cpu/mb86235/mb86235d.cpp b/src/devices/cpu/mb86235/mb86235d.cpp index 58dcfc047b6..640fef9bccf 100644 --- a/src/devices/cpu/mb86235/mb86235d.cpp +++ b/src/devices/cpu/mb86235/mb86235d.cpp @@ -833,7 +833,7 @@ static unsigned dasm_mb86235(char *buffer, UINT32 pc, UINT64 opcode) CPU_DISASSEMBLE( mb86235 ) { UINT64 op = *(UINT64*)oprom; - op = LITTLE_ENDIANIZE_INT64(op); + op = little_endianize_int64(op); return dasm_mb86235(buffer, pc, op); } diff --git a/src/devices/cpu/mips/mips3.cpp b/src/devices/cpu/mips/mips3.cpp index 73b5974bab7..306760f33d3 100644 --- a/src/devices/cpu/mips/mips3.cpp +++ b/src/devices/cpu/mips/mips3.cpp @@ -968,9 +968,9 @@ offs_t mips3_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8 *op extern unsigned dasmmips3(char *, unsigned, UINT32); UINT32 op = *(UINT32 *)oprom; if (m_bigendian) - op = BIG_ENDIANIZE_INT32(op); + op = big_endianize_int32(op); else - op = LITTLE_ENDIANIZE_INT32(op); + op = little_endianize_int32(op); return dasmmips3(buffer, pc, op); } diff --git a/src/devices/cpu/mips/mips3dsm.cpp b/src/devices/cpu/mips/mips3dsm.cpp index 71e81ca7b5c..0eca3d73c54 100644 --- a/src/devices/cpu/mips/mips3dsm.cpp +++ b/src/devices/cpu/mips/mips3dsm.cpp @@ -539,7 +539,7 @@ unsigned dasmmips3(char *buffer, unsigned pc, UINT32 op) CPU_DISASSEMBLE( mips3be ) { UINT32 op = *(UINT32 *)oprom; - op = BIG_ENDIANIZE_INT32(op); + op = big_endianize_int32(op); return dasmmips3(buffer, pc, op); } @@ -547,6 +547,6 @@ CPU_DISASSEMBLE( mips3be ) CPU_DISASSEMBLE( mips3le ) { UINT32 op = *(UINT32 *)oprom; - op = LITTLE_ENDIANIZE_INT32(op); + op = little_endianize_int32(op); return dasmmips3(buffer, pc, op); } diff --git a/src/devices/cpu/mips/r3kdasm.cpp b/src/devices/cpu/mips/r3kdasm.cpp index 3e65c0f0e9c..01cf1ad7599 100644 --- a/src/devices/cpu/mips/r3kdasm.cpp +++ b/src/devices/cpu/mips/r3kdasm.cpp @@ -381,7 +381,7 @@ static unsigned dasmr3k(char *buffer, unsigned pc, UINT32 op) CPU_DISASSEMBLE( r3000be ) { UINT32 op = *(UINT32 *)oprom; - op = BIG_ENDIANIZE_INT32(op); + op = big_endianize_int32(op); return dasmr3k(buffer, pc, op); } @@ -389,6 +389,6 @@ CPU_DISASSEMBLE( r3000be ) CPU_DISASSEMBLE( r3000le ) { UINT32 op = *(UINT32 *)oprom; - op = LITTLE_ENDIANIZE_INT32(op); + op = little_endianize_int32(op); return dasmr3k(buffer, pc, op); } diff --git a/src/devices/cpu/powerpc/ppc_dasm.cpp b/src/devices/cpu/powerpc/ppc_dasm.cpp index d80f800c89b..25a79140193 100644 --- a/src/devices/cpu/powerpc/ppc_dasm.cpp +++ b/src/devices/cpu/powerpc/ppc_dasm.cpp @@ -1172,6 +1172,6 @@ offs_t ppc_dasm_one(char *buffer, UINT32 pc, UINT32 op) CPU_DISASSEMBLE( powerpc ) { UINT32 op = *(UINT32 *)oprom; - op = BIG_ENDIANIZE_INT32(op); + op = big_endianize_int32(op); return ppc_dasm_one(buffer, pc, op); } diff --git a/src/devices/cpu/powerpc/ppccom.cpp b/src/devices/cpu/powerpc/ppccom.cpp index cb647c20040..081aa5d0838 100644 --- a/src/devices/cpu/powerpc/ppccom.cpp +++ b/src/devices/cpu/powerpc/ppccom.cpp @@ -1235,7 +1235,7 @@ offs_t ppc_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8 *opro { extern offs_t ppc_dasm_one(char *buffer, UINT32 pc, UINT32 op); UINT32 op = *(UINT32 *)oprom; - op = BIG_ENDIANIZE_INT32(op); + op = big_endianize_int32(op); return ppc_dasm_one(buffer, pc, op); } diff --git a/src/devices/cpu/rsp/rsp_dasm.cpp b/src/devices/cpu/rsp/rsp_dasm.cpp index d4ade625904..b430a43a75d 100644 --- a/src/devices/cpu/rsp/rsp_dasm.cpp +++ b/src/devices/cpu/rsp/rsp_dasm.cpp @@ -359,6 +359,6 @@ offs_t rsp_dasm_one(char *buffer, offs_t pc, UINT32 op) CPU_DISASSEMBLE( rsp ) { UINT32 op = *(UINT32 *)opram; - op = BIG_ENDIANIZE_INT32(op); + op = big_endianize_int32(op); return rsp_dasm_one(buffer, pc, op); } diff --git a/src/devices/cpu/sparc/mb86901.cpp b/src/devices/cpu/sparc/mb86901.cpp index 1e9eafebcb1..be7edbe6284 100644 --- a/src/devices/cpu/sparc/mb86901.cpp +++ b/src/devices/cpu/sparc/mb86901.cpp @@ -550,7 +550,7 @@ UINT32 mb86901_device::disasm_max_opcode_bytes() const offs_t mb86901_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options) { UINT32 op = *reinterpret_cast<const UINT32 *>(oprom); - return m_dasm.dasm(buffer, pc, BIG_ENDIANIZE_INT32(op)); + return m_dasm.dasm(buffer, pc, big_endianize_int32(op)); } diff --git a/src/devices/cpu/unsp/unspdasm.cpp b/src/devices/cpu/unsp/unspdasm.cpp index f755a3fcf5a..34f153fc916 100644 --- a/src/devices/cpu/unsp/unspdasm.cpp +++ b/src/devices/cpu/unsp/unspdasm.cpp @@ -61,8 +61,8 @@ CPU_DISASSEMBLE( unsp ) { UINT16 op = *(UINT16 *)oprom; UINT16 imm16 = *(UINT16 *)(oprom + 2); - op = BIG_ENDIANIZE_INT16(op); - imm16 = BIG_ENDIANIZE_INT16(imm16); + op = big_endianize_int16(op); + imm16 = big_endianize_int16(imm16); output = buffer; diff --git a/src/devices/machine/strata.cpp b/src/devices/machine/strata.cpp index 4f7006f4d99..0bf396d83ef 100644 --- a/src/devices/machine/strata.cpp +++ b/src/devices/machine/strata.cpp @@ -94,7 +94,7 @@ void strataflash_device::nvram_read(emu_file &file) for (i = 0; i < FEEPROM_SIZE; i += 2) { UINT16 *ptr = (UINT16 *) (&m_flashmemory[i]); - *ptr = LITTLE_ENDIANIZE_INT16(*ptr); + *ptr = little_endianize_int16(*ptr); } // protection registers @@ -103,7 +103,7 @@ void strataflash_device::nvram_read(emu_file &file) for (i = 0; i < PROT_REGS_SIZE; i += 2) { UINT16 *ptr = (UINT16 *) (&m_prot_regs[i]); - *ptr = LITTLE_ENDIANIZE_INT16(*ptr); + *ptr = little_endianize_int16(*ptr); } // block lock flags @@ -142,28 +142,28 @@ void strataflash_device::nvram_write(emu_file &file) for (i = 0; i < FEEPROM_SIZE; i += 2) { UINT16 *ptr = (UINT16 *) (&m_flashmemory[i]); - *ptr = LITTLE_ENDIANIZE_INT16(*ptr); + *ptr = little_endianize_int16(*ptr); } if (file->write(m_flashmemory, FEEPROM_SIZE) != FEEPROM_SIZE) return 1; for (i = 0; i < FEEPROM_SIZE; i += 2) { UINT16 *ptr = (UINT16 *) (&m_flashmemory[i]); - *ptr = LITTLE_ENDIANIZE_INT16(*ptr); + *ptr = little_endianize_int16(*ptr); } // protection registers for (i = 0; i < PROT_REGS_SIZE; i += 2) { UINT16 *ptr = (UINT16 *) (&m_prot_regs[i]); - *ptr = LITTLE_ENDIANIZE_INT16(*ptr); + *ptr = little_endianize_int16(*ptr); } if (file->write(m_prot_regs, PROT_REGS_SIZE) != PROT_REGS_SIZE) return 1; for (i = 0; i < PROT_REGS_SIZE; i += 2) { UINT16 *ptr = (UINT16 *) (&m_prot_regs[i]); - *ptr = LITTLE_ENDIANIZE_INT16(*ptr); + *ptr = little_endianize_int16(*ptr); } // block lock flags diff --git a/src/devices/sound/cdda.cpp b/src/devices/sound/cdda.cpp index 3223142a062..45ef2a1dc42 100644 --- a/src/devices/sound/cdda.cpp +++ b/src/devices/sound/cdda.cpp @@ -189,8 +189,8 @@ void cdda_device::get_audio_data(stream_sample_t *bufL, stream_sample_t *bufR, U for (i = 0; i < samples; i++) { /* CD-DA data on the disc is big-endian */ - *bufL++ = (INT16) BIG_ENDIANIZE_INT16( audio_cache[ m_audio_bptr ] ); m_audio_bptr++; - *bufR++ = (INT16) BIG_ENDIANIZE_INT16( audio_cache[ m_audio_bptr ] ); m_audio_bptr++; + *bufL++ = (INT16) big_endianize_int16( audio_cache[ m_audio_bptr ] ); m_audio_bptr++; + *bufR++ = (INT16) big_endianize_int16( audio_cache[ m_audio_bptr ] ); m_audio_bptr++; } samples_wanted -= samples; diff --git a/src/devices/sound/samples.cpp b/src/devices/sound/samples.cpp index 0b92b51202d..44627261377 100644 --- a/src/devices/sound/samples.cpp +++ b/src/devices/sound/samples.cpp @@ -429,7 +429,7 @@ bool samples_device::read_wav_sample(emu_file &file, sample_t &sample) osd_printf_warning("Unexpected size offset %u (%s)\n", offset, file.filename()); return false; } - filesize = LITTLE_ENDIANIZE_INT32(filesize); + filesize = little_endianize_int32(filesize); // read the RIFF file type and make sure it's a WAVE file char buf[32]; @@ -451,7 +451,7 @@ bool samples_device::read_wav_sample(emu_file &file, sample_t &sample) { offset += file.read(buf, 4); offset += file.read(&length, 4); - length = LITTLE_ENDIANIZE_INT32(length); + length = little_endianize_int32(length); if (memcmp(&buf[0], "fmt ", 4) == 0) break; @@ -468,7 +468,7 @@ bool samples_device::read_wav_sample(emu_file &file, sample_t &sample) // read the format -- make sure it is PCM UINT16 temp16; offset += file.read(&temp16, 2); - temp16 = LITTLE_ENDIANIZE_INT16(temp16); + temp16 = little_endianize_int16(temp16); if (temp16 != 1) { osd_printf_warning("unsupported format %u - only PCM is supported (%s)\n", temp16, file.filename()); @@ -477,7 +477,7 @@ bool samples_device::read_wav_sample(emu_file &file, sample_t &sample) // number of channels -- only mono is supported offset += file.read(&temp16, 2); - temp16 = LITTLE_ENDIANIZE_INT16(temp16); + temp16 = little_endianize_int16(temp16); if (temp16 != 1) { osd_printf_warning("unsupported number of channels %u - only mono is supported (%s)\n", temp16, file.filename()); @@ -487,7 +487,7 @@ bool samples_device::read_wav_sample(emu_file &file, sample_t &sample) // sample rate UINT32 rate; offset += file.read(&rate, 4); - rate = LITTLE_ENDIANIZE_INT32(rate); + rate = little_endianize_int32(rate); // bytes/second and block alignment are ignored offset += file.read(buf, 6); @@ -495,7 +495,7 @@ bool samples_device::read_wav_sample(emu_file &file, sample_t &sample) // bits/sample UINT16 bits; offset += file.read(&bits, 2); - bits = LITTLE_ENDIANIZE_INT16(bits); + bits = little_endianize_int16(bits); if (bits != 8 && bits != 16) { osd_printf_warning("unsupported bits/sample %u - only 8 and 16 are supported (%s)\n", bits, file.filename()); @@ -511,7 +511,7 @@ bool samples_device::read_wav_sample(emu_file &file, sample_t &sample) { offset += file.read(buf, 4); offset += file.read(&length, 4); - length = LITTLE_ENDIANIZE_INT32(length); + length = little_endianize_int32(length); if (memcmp(&buf[0], "data", 4) == 0) break; @@ -555,7 +555,7 @@ bool samples_device::read_wav_sample(emu_file &file, sample_t &sample) // swap high/low on big-endian systems if (ENDIANNESS_NATIVE != ENDIANNESS_LITTLE) for (UINT32 sindex = 0; sindex < length / 2; sindex++) - sample.data[sindex] = LITTLE_ENDIANIZE_INT16(sample.data[sindex]); + sample.data[sindex] = little_endianize_int16(sample.data[sindex]); } return true; } diff --git a/src/devices/video/gb_lcd.cpp b/src/devices/video/gb_lcd.cpp index 60a6684ae5f..024ba3d777a 100644 --- a/src/devices/video/gb_lcd.cpp +++ b/src/devices/video/gb_lcd.cpp @@ -1142,7 +1142,7 @@ void cgb_lcd_device::update_sprites() data = *((UINT16 *) &m_vram[((oam[3] & 0x8)<<10) + (oam[2] & tilemask) * 16 + (line - oam[0]) * 2]); } - data = LITTLE_ENDIANIZE_INT16(data); + data = little_endianize_int16(data); switch (oam[3] & 0xA0) { diff --git a/src/emu/ioport.cpp b/src/emu/ioport.cpp index c215cfd1ba4..43649e3f886 100644 --- a/src/emu/ioport.cpp +++ b/src/emu/ioport.cpp @@ -3302,11 +3302,11 @@ _Type ioport_manager::playback_read(_Type &result) // return the appropriate value else if (sizeof(result) == 8) - result = LITTLE_ENDIANIZE_INT64(result); + result = little_endianize_int64(result); else if (sizeof(result) == 4) - result = LITTLE_ENDIANIZE_INT32(result); + result = little_endianize_int32(result); else if (sizeof(result) == 2) - result = LITTLE_ENDIANIZE_INT16(result); + result = little_endianize_int16(result); return result; } diff --git a/src/emu/save.cpp b/src/emu/save.cpp index 273a3cc91cc..0dd66cd2e82 100644 --- a/src/emu/save.cpp +++ b/src/emu/save.cpp @@ -298,7 +298,7 @@ save_error save_manager::write_file(emu_file &file) header[9] = NATIVE_ENDIAN_VALUE_LE_BE(0, SS_MSB_FIRST); strncpy((char *)&header[0x0a], machine().system().name, 0x1c - 0x0a); UINT32 sig = signature(); - *(UINT32 *)&header[0x1c] = LITTLE_ENDIANIZE_INT32(sig); + *(UINT32 *)&header[0x1c] = little_endianize_int32(sig); // write the header and turn on compression for the rest of the file file.compress(FCOMPRESS_NONE); @@ -337,8 +337,8 @@ UINT32 save_manager::signature() const // add the type and size to the CRC UINT32 temp[2]; - temp[0] = LITTLE_ENDIANIZE_INT32(entry->m_typecount); - temp[1] = LITTLE_ENDIANIZE_INT32(entry->m_typesize); + temp[0] = little_endianize_int32(entry->m_typecount); + temp[1] = little_endianize_int32(entry->m_typesize); crc = core_crc32(crc, (UINT8 *)&temp[0], sizeof(temp)); } return crc; @@ -393,10 +393,10 @@ save_error save_manager::validate_header(const UINT8 *header, const char *gamena if (signature != 0) { UINT32 rawsig = *(UINT32 *)&header[0x1c]; - if (signature != LITTLE_ENDIANIZE_INT32(rawsig)) + if (signature != little_endianize_int32(rawsig)) { if (errormsg != nullptr) - (*errormsg)("%sIncompatible save file (signature %08x, expected %08x)", error_prefix, LITTLE_ENDIANIZE_INT32(rawsig), signature); + (*errormsg)("%sIncompatible save file (signature %08x, expected %08x)", error_prefix, little_endianize_int32(rawsig), signature); return STATERR_INVALID_HEADER; } } diff --git a/src/lib/formats/ap_dsk35.cpp b/src/lib/formats/ap_dsk35.cpp index 5af4c2b5bcd..baa60254b4b 100644 --- a/src/lib/formats/ap_dsk35.cpp +++ b/src/lib/formats/ap_dsk35.cpp @@ -933,11 +933,11 @@ static floperr_t apple35_diskcopy_headerdecode(floppy_image_legacy *floppy, UINT floppy_image_read(floppy, &header, 0, sizeof(header)); - header.data_size = BIG_ENDIANIZE_INT32(header.data_size); - header.tag_size = BIG_ENDIANIZE_INT32(header.tag_size); - header.data_checksum = BIG_ENDIANIZE_INT32(header.data_checksum); - header.tag_checksum = BIG_ENDIANIZE_INT32(header.tag_checksum); - header.magic = BIG_ENDIANIZE_INT16(header.magic); + header.data_size = big_endianize_int32(header.data_size); + header.tag_size = big_endianize_int32(header.tag_size); + header.data_checksum = big_endianize_int32(header.data_checksum); + header.tag_checksum = big_endianize_int32(header.tag_checksum); + header.magic = big_endianize_int16(header.magic); if (header.disk_name[0] >= sizeof(header.disk_name)) return FLOPPY_ERROR_INVALIDIMAGE; @@ -1001,10 +1001,10 @@ static FLOPPY_CONSTRUCT(apple35_diskcopy_construct) tag_size = 80*sides*10*12; memset(&header, 0, sizeof(header)); - header.data_size = BIG_ENDIANIZE_INT32(data_size); - header.tag_size = BIG_ENDIANIZE_INT32(tag_size); + header.data_size = big_endianize_int32(data_size); + header.tag_size = big_endianize_int32(tag_size); header.disk_format = (sides > 1) ? 1 : 0; - header.magic = BIG_ENDIANIZE_INT16(0x100); + header.magic = big_endianize_int16(0x100); floppy_image_write(floppy, &header, 0, sizeof(header)); floppy_image_write_filler(floppy, 0, sizeof(header), data_size + tag_size); @@ -1077,17 +1077,17 @@ static floperr_t apple35_2img_decode(floppy_image_legacy *floppy, UINT32 *image_ return FLOPPY_ERROR_INVALIDIMAGE; } - header.header_length = LITTLE_ENDIANIZE_INT16(header.header_length); - header.version = LITTLE_ENDIANIZE_INT16(header.version); - header.image_format = LITTLE_ENDIANIZE_INT32(header.image_format); - header.flags = LITTLE_ENDIANIZE_INT32(header.flags); - header.block_count = LITTLE_ENDIANIZE_INT32(header.block_count); - header.data_offset = LITTLE_ENDIANIZE_INT32(header.data_offset); - header.data_length = LITTLE_ENDIANIZE_INT32(header.data_length); - header.comment_offset = LITTLE_ENDIANIZE_INT32(header.comment_offset); - header.comment_length = LITTLE_ENDIANIZE_INT32(header.comment_length); - header.creator_offset = LITTLE_ENDIANIZE_INT32(header.creator_offset); - header.creator_length = LITTLE_ENDIANIZE_INT32(header.creator_length); + header.header_length = little_endianize_int16(header.header_length); + header.version = little_endianize_int16(header.version); + header.image_format = little_endianize_int32(header.image_format); + header.flags = little_endianize_int32(header.flags); + header.block_count = little_endianize_int32(header.block_count); + header.data_offset = little_endianize_int32(header.data_offset); + header.data_length = little_endianize_int32(header.data_length); + header.comment_offset = little_endianize_int32(header.comment_offset); + header.comment_length = little_endianize_int32(header.comment_length); + header.creator_offset = little_endianize_int32(header.creator_offset); + header.creator_length = little_endianize_int32(header.creator_length); // at least some images "in the wild" (e.g. TOSEC Minor Set 1) have big-endian data sizes // even though that's against the .2mg spec @@ -1145,10 +1145,10 @@ static FLOPPY_CONSTRUCT(apple35_2img_construct) data_size = 80*sides*10*512; memset(&header, 0, sizeof(header)); - header.header_length = LITTLE_ENDIANIZE_INT16(sizeof(header)); - header.block_count = LITTLE_ENDIANIZE_INT32(80*sides*10); - header.data_offset = LITTLE_ENDIANIZE_INT32(data_offset); - header.data_length = LITTLE_ENDIANIZE_INT32(data_size); + header.header_length = little_endianize_int16(sizeof(header)); + header.block_count = little_endianize_int32(80*sides*10); + header.data_offset = little_endianize_int32(data_offset); + header.data_length = little_endianize_int32(data_size); floppy_image_write(floppy, &header, 0, sizeof(header)); floppy_image_write_filler(floppy, 0, sizeof(header), data_size); diff --git a/src/lib/formats/csw_cas.cpp b/src/lib/formats/csw_cas.cpp index 336a9dde7cd..f2523ef839d 100644 --- a/src/lib/formats/csw_cas.cpp +++ b/src/lib/formats/csw_cas.cpp @@ -38,7 +38,7 @@ static UINT32 get_leuint32(const void *ptr) { UINT32 value; memcpy(&value, ptr, sizeof(value)); - return LITTLE_ENDIANIZE_INT32(value); + return little_endianize_int32(value); } static int mycaslen; diff --git a/src/lib/formats/d88_dsk.cpp b/src/lib/formats/d88_dsk.cpp index b676db7fd21..21c73fec5c0 100644 --- a/src/lib/formats/d88_dsk.cpp +++ b/src/lib/formats/d88_dsk.cpp @@ -420,7 +420,7 @@ int d88_format::identify(io_generic *io, UINT32 form_factor) UINT8 h[32]; io_generic_read(io, h, 0, 32); - if((LITTLE_ENDIANIZE_INT32(*(UINT32 *)(h+0x1c)) == size) && + if((little_endianize_int32(*(UINT32 *)(h+0x1c)) == size) && (h[0x1b] == 0x00 || h[0x1b] == 0x10 || h[0x1b] == 0x20 || h[0x1b] == 0x30 || h[0x1b] == 0x40)) return 100; @@ -481,7 +481,7 @@ bool d88_format::load(io_generic *io, UINT32 form_factor, floppy_image *image) for(int track=0; track < track_count; track++) for(int head=0; head < head_count; head++) { - int pos = LITTLE_ENDIANIZE_INT32(track_pos[track * head_count + head]); + int pos = little_endianize_int32(track_pos[track * head_count + head]); if(!pos) continue; @@ -494,9 +494,9 @@ bool d88_format::load(io_generic *io, UINT32 form_factor, floppy_image *image) io_generic_read(io, hs, pos, 16); pos += 16; - UINT16 size = LITTLE_ENDIANIZE_INT16(*(UINT16 *)(hs+14)); + UINT16 size = little_endianize_int16(*(UINT16 *)(hs+14)); if(i == 0) { - sector_count = LITTLE_ENDIANIZE_INT16(*(UINT16 *)(hs+4)); + sector_count = little_endianize_int16(*(UINT16 *)(hs+4)); // Support broken vfman converter if(sector_count == 0x1000) sector_count = 0x10; diff --git a/src/lib/formats/fdd_dsk.cpp b/src/lib/formats/fdd_dsk.cpp index 2c564e3e306..46aa8976605 100644 --- a/src/lib/formats/fdd_dsk.cpp +++ b/src/lib/formats/fdd_dsk.cpp @@ -97,7 +97,7 @@ bool fdd_format::load(io_generic *io, UINT32 form_factor, floppy_image *image) secs[(track * 26) + sect] = hsec[2]; sec_sizes[(track * 26) + sect] = hsec[3]; fill_vals[(track * 26) + sect] = hsec[4]; - sec_offs[(track * 26) + sect] = LITTLE_ENDIANIZE_INT32(*(UINT32 *)(hsec + 0x08)); + sec_offs[(track * 26) + sect] = little_endianize_int32(*(UINT32 *)(hsec + 0x08)); curr_track_size += (128 << hsec[3]); curr_num_sec++; diff --git a/src/lib/formats/imageutl.h b/src/lib/formats/imageutl.h index a2369e8284a..7da4a184112 100644 --- a/src/lib/formats/imageutl.h +++ b/src/lib/formats/imageutl.h @@ -34,12 +34,12 @@ static inline void place_integer_be(void *ptr, size_t offset, size_t size, UINT6 switch(size) { case 2: - val16 = BIG_ENDIANIZE_INT16((UINT16) value); + val16 = big_endianize_int16((UINT16) value); memcpy(byte_ptr, &val16, sizeof(val16)); break; case 4: - val32 = BIG_ENDIANIZE_INT32((UINT32) value); + val32 = big_endianize_int32((UINT32) value); memcpy(byte_ptr, &val32, sizeof(val32)); break; @@ -71,12 +71,12 @@ static inline UINT64 pick_integer_be(const void *ptr, size_t offset, size_t size case 2: memcpy(&val16, byte_ptr, sizeof(val16)); - result = BIG_ENDIANIZE_INT16(val16); + result = big_endianize_int16(val16); break; case 4: memcpy(&val32, byte_ptr, sizeof(val32)); - result = BIG_ENDIANIZE_INT32(val32); + result = big_endianize_int32(val32); break; default: @@ -102,12 +102,12 @@ static inline void place_integer_le(void *ptr, size_t offset, size_t size, UINT6 switch(size) { case 2: - val16 = LITTLE_ENDIANIZE_INT16((UINT16) value); + val16 = little_endianize_int16((UINT16) value); memcpy(byte_ptr, &val16, sizeof(val16)); break; case 4: - val32 = LITTLE_ENDIANIZE_INT32((UINT32) value); + val32 = little_endianize_int32((UINT32) value); memcpy(byte_ptr, &val32, sizeof(val32)); break; @@ -139,12 +139,12 @@ static inline UINT64 pick_integer_le(const void *ptr, size_t offset, size_t size case 2: memcpy(&val16, byte_ptr, sizeof(val16)); - result = LITTLE_ENDIANIZE_INT16(val16); + result = little_endianize_int16(val16); break; case 4: memcpy(&val32, byte_ptr, sizeof(val32)); - result = LITTLE_ENDIANIZE_INT32(val32); + result = little_endianize_int32(val32); break; default: diff --git a/src/lib/formats/nfd_dsk.cpp b/src/lib/formats/nfd_dsk.cpp index 816498190a7..0691543cce6 100644 --- a/src/lib/formats/nfd_dsk.cpp +++ b/src/lib/formats/nfd_dsk.cpp @@ -129,7 +129,7 @@ bool nfd_format::load(io_generic *io, UINT32 form_factor, floppy_image *image) UINT8 mfm[164 * 26]; UINT8 sec_sizes[164 * 26]; - UINT32 hsize = LITTLE_ENDIANIZE_INT32(*(UINT32 *)(h+0x110)); + UINT32 hsize = little_endianize_int32(*(UINT32 *)(h+0x110)); int pos = 0x120; @@ -142,7 +142,7 @@ bool nfd_format::load(io_generic *io, UINT32 form_factor, floppy_image *image) // read sector map absolute location io_generic_read(io, hsec, pos, 4); pos += 4; - UINT32 secmap_addr = LITTLE_ENDIANIZE_INT32(*(UINT32 *)(hsec)); + UINT32 secmap_addr = little_endianize_int32(*(UINT32 *)(hsec)); if (secmap_addr) { @@ -151,8 +151,8 @@ bool nfd_format::load(io_generic *io, UINT32 form_factor, floppy_image *image) // first WORD is # of sectors, second WORD is # of special data sectors io_generic_read(io, hsec, secmap_addr, 0x10); secmap_addr += 0x10; - num_secs[track] = LITTLE_ENDIANIZE_INT16(*(UINT16 *)(hsec)); - num_specials[track] = LITTLE_ENDIANIZE_INT16(*(UINT16 *)(hsec + 0x2)); + num_secs[track] = little_endianize_int16(*(UINT16 *)(hsec)); + num_specials[track] = little_endianize_int16(*(UINT16 *)(hsec + 0x2)); for (int sect = 0; sect < num_secs[track]; sect++) { @@ -177,7 +177,7 @@ bool nfd_format::load(io_generic *io, UINT32 form_factor, floppy_image *image) { io_generic_read(io, hsec, secmap_addr, 0x10); secmap_addr += 0x10; - curr_track_size += (hsec[9] + 1) * LITTLE_ENDIANIZE_INT32(*(UINT32 *)(hsec + 0x0a)); + curr_track_size += (hsec[9] + 1) * little_endianize_int32(*(UINT32 *)(hsec + 0x0a)); } } } diff --git a/src/lib/formats/pc98fdi_dsk.cpp b/src/lib/formats/pc98fdi_dsk.cpp index 1e6f1809536..c4c21d937f6 100644 --- a/src/lib/formats/pc98fdi_dsk.cpp +++ b/src/lib/formats/pc98fdi_dsk.cpp @@ -36,12 +36,12 @@ int pc98fdi_format::identify(io_generic *io, UINT32 form_factor) UINT8 h[32]; io_generic_read(io, h, 0, 32); - UINT32 hsize = LITTLE_ENDIANIZE_INT32(*(UINT32 *) (h + 0x8)); - UINT32 psize = LITTLE_ENDIANIZE_INT32(*(UINT32 *) (h + 0xc)); - UINT32 ssize = LITTLE_ENDIANIZE_INT32(*(UINT32 *) (h + 0x10)); - UINT32 scnt = LITTLE_ENDIANIZE_INT32(*(UINT32 *) (h + 0x14)); - UINT32 sides = LITTLE_ENDIANIZE_INT32(*(UINT32 *) (h + 0x18)); - UINT32 ntrk = LITTLE_ENDIANIZE_INT32(*(UINT32 *) (h + 0x1c)); + UINT32 hsize = little_endianize_int32(*(UINT32 *) (h + 0x8)); + UINT32 psize = little_endianize_int32(*(UINT32 *) (h + 0xc)); + UINT32 ssize = little_endianize_int32(*(UINT32 *) (h + 0x10)); + UINT32 scnt = little_endianize_int32(*(UINT32 *) (h + 0x14)); + UINT32 sides = little_endianize_int32(*(UINT32 *) (h + 0x18)); + UINT32 ntrk = little_endianize_int32(*(UINT32 *) (h + 0x1c)); if(size == hsize + psize && psize == ssize*scnt*sides*ntrk) return 100; @@ -54,11 +54,11 @@ bool pc98fdi_format::load(io_generic *io, UINT32 form_factor, floppy_image *imag io_generic_read(io, h, 0, 32); - UINT32 hsize = LITTLE_ENDIANIZE_INT32(*(UINT32 *)(h+0x8)); - UINT32 sector_size = LITTLE_ENDIANIZE_INT32(*(UINT32 *)(h+0x10)); - UINT32 sector_count = LITTLE_ENDIANIZE_INT32(*(UINT32 *)(h+0x14)); - UINT32 head_count = LITTLE_ENDIANIZE_INT32(*(UINT32 *)(h+0x18)); - UINT32 track_count = LITTLE_ENDIANIZE_INT32(*(UINT32 *)(h+0x1c)); + UINT32 hsize = little_endianize_int32(*(UINT32 *)(h+0x8)); + UINT32 sector_size = little_endianize_int32(*(UINT32 *)(h+0x10)); + UINT32 sector_count = little_endianize_int32(*(UINT32 *)(h+0x14)); + UINT32 head_count = little_endianize_int32(*(UINT32 *)(h+0x18)); + UINT32 track_count = little_endianize_int32(*(UINT32 *)(h+0x1c)); int cell_count = form_factor == floppy_image::FF_35 ? 200000 : 166666; diff --git a/src/lib/formats/wavfile.cpp b/src/lib/formats/wavfile.cpp index 1cb4746f39c..f827102a57b 100644 --- a/src/lib/formats/wavfile.cpp +++ b/src/lib/formats/wavfile.cpp @@ -27,7 +27,7 @@ static UINT32 get_leuint32(const void *ptr) { UINT32 value; memcpy(&value, ptr, sizeof(value)); - return LITTLE_ENDIANIZE_INT32(value); + return little_endianize_int32(value); } @@ -36,14 +36,14 @@ static UINT16 get_leuint16(const void *ptr) { UINT16 value; memcpy(&value, ptr, sizeof(value)); - return LITTLE_ENDIANIZE_INT16(value); + return little_endianize_int16(value); } static void put_leuint32(void *ptr, UINT32 value) { - value = LITTLE_ENDIANIZE_INT32(value); + value = little_endianize_int32(value); memcpy(ptr, &value, sizeof(value)); } @@ -51,7 +51,7 @@ static void put_leuint32(void *ptr, UINT32 value) static void put_leuint16(void *ptr, UINT16 value) { - value = LITTLE_ENDIANIZE_INT16(value); + value = little_endianize_int16(value); memcpy(ptr, &value, sizeof(value)); } diff --git a/src/lib/util/aviio.cpp b/src/lib/util/aviio.cpp index 08fa138a177..f0feceeffbd 100644 --- a/src/lib/util/aviio.cpp +++ b/src/lib/util/aviio.cpp @@ -1760,7 +1760,7 @@ avi_file::error avi_file_impl::read_sound_samples(int channel, std::uint32_t fir base += stream->channels() * (firstsample - chunkbase) + offset; for (sampnum = 0; sampnum < samples_this_chunk; sampnum++) { - *output++ = LITTLE_ENDIANIZE_INT16(*base); + *output++ = little_endianize_int16(*base); base += stream->channels(); } } @@ -1939,7 +1939,7 @@ avi_file::error avi_file_impl::append_sound_samples(int channel, const std::int1 { std::int16_t data = *samples++; samples += sampleskip; - data = LITTLE_ENDIANIZE_INT16(data); + data = little_endianize_int16(data); m_soundbuf[sampoffset++ * m_info.audio_channels + channel] = data; } m_soundbuf_chansamples[channel] = sampoffset; diff --git a/src/lib/util/chdcd.cpp b/src/lib/util/chdcd.cpp index 4e3fb152eb3..76da08b6b9e 100644 --- a/src/lib/util/chdcd.cpp +++ b/src/lib/util/chdcd.cpp @@ -245,7 +245,7 @@ static UINT32 parse_wav_sample(const char *filename, UINT32 *dataoffs) printf("ERROR: unexpected size offset %lu (%s)\n", offset, filename); return 0; } - filesize = LITTLE_ENDIANIZE_INT32(filesize); + filesize = little_endianize_int32(filesize); /* read the RIFF file type and make sure it's a WAVE file */ file->read(buf, offset, 4, actual); @@ -268,7 +268,7 @@ static UINT32 parse_wav_sample(const char *filename, UINT32 *dataoffs) offset += actual; file->read(&length, offset, 4, actual); offset += actual; - length = LITTLE_ENDIANIZE_INT32(length); + length = little_endianize_int32(length); if (memcmp(&buf[0], "fmt ", 4) == 0) break; @@ -284,7 +284,7 @@ static UINT32 parse_wav_sample(const char *filename, UINT32 *dataoffs) /* read the format -- make sure it is PCM */ file->read(&temp16, offset, 2, actual); offset += actual; - temp16 = LITTLE_ENDIANIZE_INT16(temp16); + temp16 = little_endianize_int16(temp16); if (temp16 != 1) { printf("ERROR: unsupported format %u - only PCM is supported (%s)\n", temp16, filename); @@ -294,7 +294,7 @@ static UINT32 parse_wav_sample(const char *filename, UINT32 *dataoffs) /* number of channels -- only stereo is supported */ file->read(&temp16, offset, 2, actual); offset += actual; - temp16 = LITTLE_ENDIANIZE_INT16(temp16); + temp16 = little_endianize_int16(temp16); if (temp16 != 2) { printf("ERROR: unsupported number of channels %u - only stereo is supported (%s)\n", temp16, filename); @@ -304,7 +304,7 @@ static UINT32 parse_wav_sample(const char *filename, UINT32 *dataoffs) /* sample rate */ file->read(&rate, offset, 4, actual); offset += actual; - rate = LITTLE_ENDIANIZE_INT32(rate); + rate = little_endianize_int32(rate); if (rate != 44100) { printf("ERROR: unsupported samplerate %u - only 44100 is supported (%s)\n", rate, filename); @@ -318,7 +318,7 @@ static UINT32 parse_wav_sample(const char *filename, UINT32 *dataoffs) /* bits/sample */ file->read(&bits, offset, 2, actual); offset += actual; - bits = LITTLE_ENDIANIZE_INT16(bits); + bits = little_endianize_int16(bits); if (bits != 16) { printf("ERROR: unsupported bits/sample %u - only 16 is supported (%s)\n", bits, filename); @@ -335,7 +335,7 @@ static UINT32 parse_wav_sample(const char *filename, UINT32 *dataoffs) offset += actual; file->read(&length, offset, 4, actual); offset += actual; - length = LITTLE_ENDIANIZE_INT32(length); + length = little_endianize_int32(length); if (memcmp(&buf[0], "data", 4) == 0) break; diff --git a/src/lib/util/corefile.cpp b/src/lib/util/corefile.cpp index 8e52b942d2f..5fcd9e00239 100644 --- a/src/lib/util/corefile.cpp +++ b/src/lib/util/corefile.cpp @@ -463,12 +463,12 @@ int core_text_file::getc() case text_file_type::UTF32BE: if (read(&uchar, sizeof(uchar)) == sizeof(uchar)) - uchar = BIG_ENDIANIZE_INT32(uchar); + uchar = big_endianize_int32(uchar); break; case text_file_type::UTF32LE: if (read(&uchar, sizeof(uchar)) == sizeof(uchar)) - uchar = LITTLE_ENDIANIZE_INT32(uchar); + uchar = little_endianize_int32(uchar); break; } diff --git a/src/lib/util/png.cpp b/src/lib/util/png.cpp index 73c43e9cf90..11c0bb4db7b 100644 --- a/src/lib/util/png.cpp +++ b/src/lib/util/png.cpp @@ -62,13 +62,13 @@ static inline UINT8 fetch_8bit(UINT8 *v) #ifdef UNUSED_FUNCTION static inline UINT16 fetch_16bit(UINT8 *v) { - return BIG_ENDIANIZE_INT16(*(UINT16 *)v); + return big_endianize_int16(*(UINT16 *)v); } #endif static inline UINT32 fetch_32bit(UINT8 *v) { - return BIG_ENDIANIZE_INT32(*(UINT32 *)v); + return big_endianize_int32(*(UINT32 *)v); } @@ -81,13 +81,13 @@ static inline void put_8bit(UINT8 *v, UINT8 data) #ifdef UNUSED_FUNCTION static inline void put_16bit(UINT8 *v, UINT16 data) { - *(UINT16 *)v = BIG_ENDIANIZE_INT16(data); + *(UINT16 *)v = big_endianize_int16(data); } #endif static inline void put_32bit(UINT8 *v, UINT32 data) { - *(UINT32 *)v = BIG_ENDIANIZE_INT32(data); + *(UINT32 *)v = big_endianize_int32(data); } diff --git a/src/lib/util/wavwrite.cpp b/src/lib/util/wavwrite.cpp index 7172873a14d..d052287216d 100644 --- a/src/lib/util/wavwrite.cpp +++ b/src/lib/util/wavwrite.cpp @@ -47,33 +47,33 @@ wav_file *wav_open(const char *filename, int sample_rate, int channels) fwrite("fmt ", 1, 4, wav->file); /* write the format length */ - temp32 = LITTLE_ENDIANIZE_INT32(16); + temp32 = little_endianize_int32(16); fwrite(&temp32, 1, 4, wav->file); /* write the format (PCM) */ - temp16 = LITTLE_ENDIANIZE_INT16(1); + temp16 = little_endianize_int16(1); fwrite(&temp16, 1, 2, wav->file); /* write the channels */ - temp16 = LITTLE_ENDIANIZE_INT16(channels); + temp16 = little_endianize_int16(channels); fwrite(&temp16, 1, 2, wav->file); /* write the sample rate */ - temp32 = LITTLE_ENDIANIZE_INT32(sample_rate); + temp32 = little_endianize_int32(sample_rate); fwrite(&temp32, 1, 4, wav->file); /* write the bytes/second */ bps = sample_rate * 2 * channels; - temp32 = LITTLE_ENDIANIZE_INT32(bps); + temp32 = little_endianize_int32(bps); fwrite(&temp32, 1, 4, wav->file); /* write the block align */ align = 2 * channels; - temp16 = LITTLE_ENDIANIZE_INT16(align); + temp16 = little_endianize_int16(align); fwrite(&temp16, 1, 2, wav->file); /* write the bits/sample */ - temp16 = LITTLE_ENDIANIZE_INT16(16); + temp16 = little_endianize_int16(16); fwrite(&temp16, 1, 2, wav->file); /* write the 'data' tag */ @@ -100,13 +100,13 @@ void wav_close(wav_file *wav) /* update the total file size */ fseek(wav->file, wav->total_offs, SEEK_SET); temp32 = total - (wav->total_offs + 4); - temp32 = LITTLE_ENDIANIZE_INT32(temp32); + temp32 = little_endianize_int32(temp32); fwrite(&temp32, 1, 4, wav->file); /* update the data size */ fseek(wav->file, wav->data_offs, SEEK_SET); temp32 = total - (wav->data_offs + 4); - temp32 = LITTLE_ENDIANIZE_INT32(temp32); + temp32 = little_endianize_int32(temp32); fwrite(&temp32, 1, 4, wav->file); fclose(wav->file); diff --git a/src/mame/audio/snes_snd.cpp b/src/mame/audio/snes_snd.cpp index a9295fd560c..127fec049ce 100644 --- a/src/mame/audio/snes_snd.cpp +++ b/src/mame/audio/snes_snd.cpp @@ -149,8 +149,8 @@ static const int ENVCNT[0x20] #define SR( v ) (m_dsp_regs[((v) << 4) + 6] & 0x1f) /* Returns SUSTAIN rate */ /* Handle endianness */ -#define LEtoME16( x ) LITTLE_ENDIANIZE_INT16(x) -#define MEtoLE16( x ) LITTLE_ENDIANIZE_INT16(x) +#define LEtoME16( x ) little_endianize_int16(x) +#define MEtoLE16( x ) little_endianize_int16(x) const device_type SNES = &device_creator<snes_sound_device>; diff --git a/src/mame/drivers/apexc.cpp b/src/mame/drivers/apexc.cpp index acbdb0b39c0..2dac4620982 100644 --- a/src/mame/drivers/apexc.cpp +++ b/src/mame/drivers/apexc.cpp @@ -118,7 +118,7 @@ bool apexc_cylinder_image_device::call_load() UINT32 *RAM = (UINT32 *)(machine().root_device().memregion("maincpu")->base()); for (int i=0; i < 0x0400; i++) - RAM[i] = BIG_ENDIANIZE_INT32(RAM[i]); + RAM[i] = big_endianize_int32(RAM[i]); } #endif @@ -139,7 +139,7 @@ void apexc_cylinder_image_device::call_unload() UINT32 *RAM = (UINT32 *)(machine().root_device().memregion("maincpu")->base()); for (int i=0; i < /*0x2000*/0x0400; i++) - RAM[i] = BIG_ENDIANIZE_INT32(RAM[i]); + RAM[i] = big_endianize_int32(RAM[i]); } #endif /* write */ diff --git a/src/mame/drivers/cps3.cpp b/src/mame/drivers/cps3.cpp index f82276b13c9..4d703937971 100644 --- a/src/mame/drivers/cps3.cpp +++ b/src/mame/drivers/cps3.cpp @@ -1331,7 +1331,7 @@ UINT32 cps3_state::screen_update_cps3(screen_device &screen, bitmap_rgb32 &bitma READ32_MEMBER(cps3_state::cps3_ssram_r) { if (offset>0x8000/4) - return LITTLE_ENDIANIZE_INT32(m_ss_ram[offset]); + return little_endianize_int32(m_ss_ram[offset]); else return m_ss_ram[offset]; } @@ -1341,8 +1341,8 @@ WRITE32_MEMBER(cps3_state::cps3_ssram_w) if (offset>0x8000/4) { // we only want to endian-flip the character data, the tilemap info is fine - data = LITTLE_ENDIANIZE_INT32(data); - mem_mask = LITTLE_ENDIANIZE_INT32(mem_mask); + data = little_endianize_int32(data); + mem_mask = little_endianize_int32(mem_mask); m_gfxdecode->gfx(0)->mark_dirty(offset/16); } @@ -1389,14 +1389,14 @@ READ32_MEMBER(cps3_state::cram_data_r) { UINT32 fulloffset = (((m_cram_bank&0x7)*0x100000)/4) + offset; - return LITTLE_ENDIANIZE_INT32(m_char_ram[fulloffset]); + return little_endianize_int32(m_char_ram[fulloffset]); } WRITE32_MEMBER(cps3_state::cram_data_w) { UINT32 fulloffset = (((m_cram_bank&0x7)*0x100000)/4) + offset; - mem_mask = LITTLE_ENDIANIZE_INT32(mem_mask); - data = LITTLE_ENDIANIZE_INT32(data); + mem_mask = little_endianize_int32(mem_mask); + data = little_endianize_int32(data); COMBINE_DATA(&m_char_ram[fulloffset]); m_gfxdecode->gfx(1)->mark_dirty(fulloffset/0x40); } @@ -2016,9 +2016,9 @@ void cps3_state::cps3_process_character_dma(UINT32 address) for (i = 0; i < 0x1000; i += 3) { - UINT32 dat1 = LITTLE_ENDIANIZE_INT32(m_char_ram[i + 0 + (address)]); - UINT32 dat2 = LITTLE_ENDIANIZE_INT32(m_char_ram[i + 1 + (address)]); - UINT32 dat3 = LITTLE_ENDIANIZE_INT32(m_char_ram[i + 2 + (address)]); + UINT32 dat1 = little_endianize_int32(m_char_ram[i + 0 + (address)]); + UINT32 dat2 = little_endianize_int32(m_char_ram[i + 1 + (address)]); + UINT32 dat3 = little_endianize_int32(m_char_ram[i + 2 + (address)]); UINT32 real_source = (dat3 << 1) - 0x400000; UINT32 real_destination = dat2 << 3; UINT32 real_length = (((dat1 & 0x001fffff) + 1) << 3); diff --git a/src/mame/drivers/homelab.cpp b/src/mame/drivers/homelab.cpp index 7c1ab0eb2cc..66bb22675db 100644 --- a/src/mame/drivers/homelab.cpp +++ b/src/mame/drivers/homelab.cpp @@ -698,8 +698,8 @@ QUICKLOAD_LOAD_MEMBER( homelab_state,homelab) return IMAGE_INIT_FAIL; } - quick_addr = LITTLE_ENDIANIZE_INT16(args[0]); - quick_length = LITTLE_ENDIANIZE_INT16(args[1]); + quick_addr = little_endianize_int16(args[0]); + quick_length = little_endianize_int16(args[1]); quick_end = quick_addr+quick_length-1; if (quick_end > 0x7fff) diff --git a/src/mame/drivers/mekd2.cpp b/src/mame/drivers/mekd2.cpp index a2b7d1f9d71..3e35ea23fff 100644 --- a/src/mame/drivers/mekd2.cpp +++ b/src/mame/drivers/mekd2.cpp @@ -315,9 +315,9 @@ QUICKLOAD_LOAD_MEMBER( mekd2_state, mekd2_quik ) return IMAGE_INIT_FAIL; } image.fread(&addr, 2); - addr = LITTLE_ENDIANIZE_INT16(addr); + addr = little_endianize_int16(addr); image.fread(&size, 2); - size = LITTLE_ENDIANIZE_INT16(size); + size = little_endianize_int16(size); image.fread(&ident, 1); logerror("mekd2 rom load: $%04X $%04X $%02X\n", addr, size, ident); while (size-- > 0) diff --git a/src/mame/drivers/tmnt.cpp b/src/mame/drivers/tmnt.cpp index 6f5aef5d5bb..9e10bef4773 100644 --- a/src/mame/drivers/tmnt.cpp +++ b/src/mame/drivers/tmnt.cpp @@ -4095,9 +4095,9 @@ static void chunky_to_planar(memory_region *rgn) for (int i = 0; i < len; i++) { - UINT32 data = LITTLE_ENDIANIZE_INT32(ROM[i]); + UINT32 data = little_endianize_int32(ROM[i]); data = BITSWAP32(data,31,27,23,19,15,11,7,3,30,26,22,18,14,10,6,2,29,25,21,17,13,9,5,1,28,24,20,16,12,8,4,0); - ROM[i] = LITTLE_ENDIANIZE_INT32(data); + ROM[i] = little_endianize_int32(data); } } diff --git a/src/mame/machine/cbm_snqk.cpp b/src/mame/machine/cbm_snqk.cpp index e066aa8e262..348f252432f 100644 --- a/src/mame/machine/cbm_snqk.cpp +++ b/src/mame/machine/cbm_snqk.cpp @@ -66,7 +66,7 @@ int general_cbm_loadsnap( device_image_interface &image, const char *file_type, } image.fread( &address, 2); - address = LITTLE_ENDIANIZE_INT16(address); + address = little_endianize_int16(address); if (!core_stricmp(file_type, "t64")) address = 2049; snapshot_size -= 2; diff --git a/src/mame/machine/decocrpt.cpp b/src/mame/machine/decocrpt.cpp index 3ada025a017..680481a3e52 100644 --- a/src/mame/machine/decocrpt.cpp +++ b/src/mame/machine/decocrpt.cpp @@ -610,7 +610,7 @@ static void deco_decrypt(running_machine &machine,const char *rgntag,const UINT8 /* we work on 16-bit words but data is loaded as 8-bit, so swap bytes on LSB machines */ if (ENDIANNESS_NATIVE == ENDIANNESS_LITTLE) for (i = 0;i < len;i++) - rom[i] = BIG_ENDIANIZE_INT16(rom[i]); + rom[i] = big_endianize_int16(rom[i]); memcpy(&buffer[0],rom,len*2); @@ -644,7 +644,7 @@ static void deco_decrypt(running_machine &machine,const char *rgntag,const UINT8 /* we work on 16-bit words but data is loaded as 8-bit, so swap bytes on LSB machines */ if (ENDIANNESS_NATIVE == ENDIANNESS_LITTLE) for (i = 0;i < len;i++) - rom[i] = BIG_ENDIANIZE_INT16(rom[i]); + rom[i] = big_endianize_int16(rom[i]); } void deco56_decrypt_gfx(running_machine &machine, const char *tag) diff --git a/src/mame/machine/fddebug.cpp b/src/mame/machine/fddebug.cpp index a384512642d..22276a29f66 100644 --- a/src/mame/machine/fddebug.cpp +++ b/src/mame/machine/fddebug.cpp @@ -600,7 +600,7 @@ static void load_overlay_file(running_machine &machine) /* convert from big-endian */ for (pcaddr = 0; pcaddr < keystatus_words; pcaddr++) - keystatus[pcaddr] = BIG_ENDIANIZE_INT16(keystatus[pcaddr]) & ~SEARCH_MASK; + keystatus[pcaddr] = big_endianize_int16(keystatus[pcaddr]) & ~SEARCH_MASK; } /* mark the key dirty */ @@ -624,14 +624,14 @@ static void save_overlay_file(running_machine &machine) { /* convert to big-endian */ for (pcaddr = 0; pcaddr < keystatus_words; pcaddr++) - keystatus[pcaddr] = BIG_ENDIANIZE_INT16(keystatus[pcaddr]); + keystatus[pcaddr] = big_endianize_int16(keystatus[pcaddr]); /* write the data */ file.write(keystatus, keystatus_words * 2); /* convert from big-endian */ for (pcaddr = 0; pcaddr < keystatus_words; pcaddr++) - keystatus[pcaddr] = BIG_ENDIANIZE_INT16(keystatus[pcaddr]); + keystatus[pcaddr] = big_endianize_int16(keystatus[pcaddr]); } } diff --git a/src/mame/machine/z80bin.cpp b/src/mame/machine/z80bin.cpp index ac18c8e7e11..d058ea613db 100644 --- a/src/mame/machine/z80bin.cpp +++ b/src/mame/machine/z80bin.cpp @@ -51,9 +51,9 @@ int z80bin_load_file(device_image_interface *image, address_space &space, const return IMAGE_INIT_FAIL; } - exec_addr[0] = LITTLE_ENDIANIZE_INT16(args[0]); - start_addr[0] = LITTLE_ENDIANIZE_INT16(args[1]); - end_addr[0] = LITTLE_ENDIANIZE_INT16(args[2]); + exec_addr[0] = little_endianize_int16(args[0]); + start_addr[0] = little_endianize_int16(args[1]); + end_addr[0] = little_endianize_int16(args[2]); size = (end_addr[0] - start_addr[0] + 1) & 0xffff; diff --git a/src/osd/osdcomm.h b/src/osd/osdcomm.h index d7f55d98d71..a97920cff7f 100644 --- a/src/osd/osdcomm.h +++ b/src/osd/osdcomm.h @@ -149,19 +149,19 @@ constexpr UINT64 flipendian_int64_partial32(UINT64 val) { return ((flipendian_in constexpr UINT64 flipendian_int64(UINT64 val) { return (flipendian_int64_partial32(val) << 32) | (flipendian_int64_partial32(val) >> 32); } #ifdef LSB_FIRST -constexpr UINT16 BIG_ENDIANIZE_INT16(UINT16 x) { return flipendian_int16(x); } -constexpr UINT32 BIG_ENDIANIZE_INT32(UINT32 x) { return flipendian_int32(x); } -constexpr UINT64 BIG_ENDIANIZE_INT64(UINT64 x) { return flipendian_int64(x); } -#define LITTLE_ENDIANIZE_INT16(x) (x) -#define LITTLE_ENDIANIZE_INT32(x) (x) -#define LITTLE_ENDIANIZE_INT64(x) (x) +constexpr UINT16 big_endianize_int16(UINT16 x) { return flipendian_int16(x); } +constexpr UINT32 big_endianize_int32(UINT32 x) { return flipendian_int32(x); } +constexpr UINT64 big_endianize_int64(UINT64 x) { return flipendian_int64(x); } +constexpr UINT16 little_endianize_int16(UINT16 x) { return x; } +constexpr UINT32 little_endianize_int32(UINT32 x) { return x; } +constexpr UINT64 little_endianize_int64(UINT64 x) { return x; } #else -#define BIG_ENDIANIZE_INT16(x) (x) -#define BIG_ENDIANIZE_INT32(x) (x) -#define BIG_ENDIANIZE_INT64(x) (x) -constexpr UINT16 LITTLE_ENDIANIZE_INT16(UINT16 x) { return flipendian_int16(x); } -constexpr UINT32 LITTLE_ENDIANIZE_INT32(UINT32 x) { return flipendian_int32(x); } -constexpr UINT64 LITTLE_ENDIANIZE_INT64(UINT64 x) { return flipendian_int64(x); } +constexpr UINT16 big_endianize_int16(UINT16 x) { return x; } +constexpr UINT32 big_endianize_int32(UINT32 x) { return x; } +constexpr UINT64 big_endianize_int64(UINT64 x) { return x; } +constexpr UINT16 little_endianize_int16(UINT16 x) { return flipendian_int16(x); } +constexpr UINT32 little_endianize_int32(UINT32 x) { return flipendian_int32(x); } +constexpr UINT64 little_endianize_int64(UINT64 x) { return flipendian_int64(x); } #endif /* LSB_FIRST */ #ifdef _MSC_VER diff --git a/src/tools/imgtool/modules/amiga.cpp b/src/tools/imgtool/modules/amiga.cpp index 35e8b896c1f..fa53e24dfad 100644 --- a/src/tools/imgtool/modules/amiga.cpp +++ b/src/tools/imgtool/modules/amiga.cpp @@ -367,7 +367,7 @@ static void copy_integer_array_be(UINT32 *dest, const UINT32 *source, int size) for (i = 0; i < size; i++) { - dest[i] = BIG_ENDIANIZE_INT32(source[i]); + dest[i] = big_endianize_int32(source[i]); } } @@ -375,9 +375,9 @@ static void copy_integer_array_be(UINT32 *dest, const UINT32 *source, int size) /* This function converts an array of UINT32s to an amiga_date */ static void copy_date_be(amiga_date *dest, const UINT32 *source) { - dest->days = BIG_ENDIANIZE_INT32(source[0]); - dest->mins = BIG_ENDIANIZE_INT32(source[1]); - dest->ticks = BIG_ENDIANIZE_INT32(source[2]); + dest->days = big_endianize_int32(source[0]); + dest->mins = big_endianize_int32(source[1]); + dest->ticks = big_endianize_int32(source[2]); } diff --git a/src/tools/imgtool/modules/fat.cpp b/src/tools/imgtool/modules/fat.cpp index c2943625d91..4de934819b9 100644 --- a/src/tools/imgtool/modules/fat.cpp +++ b/src/tools/imgtool/modules/fat.cpp @@ -578,7 +578,7 @@ static imgtoolerr_t fat_partition_create(imgtool_image *image, UINT64 first_bloc first_fat_entries = ((UINT64) media_descriptor) | 0xFFFFFF00; first_fat_entries &= (((UINT64) 1) << fat_bits) - 1; first_fat_entries |= ((((UINT64) 1) << fat_bits) - 1) << fat_bits; - first_fat_entries = LITTLE_ENDIANIZE_INT64(first_fat_entries); + first_fat_entries = little_endianize_int64(first_fat_entries); for (i = 0; i < fat_count; i++) { @@ -698,7 +698,7 @@ static UINT32 fat_get_fat_entry(imgtool_partition *partition, const UINT8 *fat_t * disk_info->sectors_per_fat) + (bit_index / 8), sizeof(entry)); /* we've extracted the bytes; we now need to normalize it */ - entry = LITTLE_ENDIANIZE_INT64(entry); + entry = little_endianize_int64(entry); entry >>= bit_index % 8; entry &= bit_mask; @@ -735,10 +735,10 @@ static void fat_set_fat_entry(imgtool_partition *partition, UINT8 *fat_table, UI memcpy(&entry, fat_table + (i * FAT_SECLEN * disk_info->sectors_per_fat) + (bit_index / 8), sizeof(entry)); - entry = LITTLE_ENDIANIZE_INT64(entry); + entry = little_endianize_int64(entry); entry &= (~((UINT64) 0xFFFFFFFF >> (32 - disk_info->fat_bits)) << (bit_index % 8)) | ((1 << (bit_index % 8)) - 1); entry |= ((UINT64) value) << (bit_index % 8); - entry = LITTLE_ENDIANIZE_INT64(entry); + entry = little_endianize_int64(entry); memcpy(fat_table + (i * FAT_SECLEN * disk_info->sectors_per_fat) + (bit_index / 8), &entry, sizeof(entry)); @@ -1166,7 +1166,7 @@ static void prepend_lfn_bytes(utf16_char *lfn_buf, size_t lfn_buflen, size_t *lf { /* read the character */ memcpy(&w, &entry[offset + i * 2], 2); - w = LITTLE_ENDIANIZE_INT16(w); + w = little_endianize_int16(w); /* append to buffer */ lfn_buf[i] = (w != 0xFFFF) ? w : 0; diff --git a/src/tools/unidasm.cpp b/src/tools/unidasm.cpp index 1c9c74bb7e1..ddcaf7ec389 100644 --- a/src/tools/unidasm.cpp +++ b/src/tools/unidasm.cpp @@ -212,14 +212,14 @@ CPU_DISASSEMBLE( z8 ); CPU_DISASSEMBLE( z80 ); CPU_DISASSEMBLE( z8000 ); -CPU_DISASSEMBLE( sparcv7 ) { static sparc_disassembler dasm(nullptr, 7); return dasm.dasm(buffer, pc, BIG_ENDIANIZE_INT32(*reinterpret_cast<const UINT32 *>(oprom))); } -CPU_DISASSEMBLE( sparcv8 ) { static sparc_disassembler dasm(nullptr, 8); return dasm.dasm(buffer, pc, BIG_ENDIANIZE_INT32(*reinterpret_cast<const UINT32 *>(oprom))); } -CPU_DISASSEMBLE( sparcv9 ) { static sparc_disassembler dasm(nullptr, 9); return dasm.dasm(buffer, pc, BIG_ENDIANIZE_INT32(*reinterpret_cast<const UINT32 *>(oprom))); } -CPU_DISASSEMBLE( sparcv9vis1 ) { static sparc_disassembler dasm(nullptr, 9, sparc_disassembler::vis_1); return dasm.dasm(buffer, pc, BIG_ENDIANIZE_INT32(*reinterpret_cast<const UINT32 *>(oprom))); } -CPU_DISASSEMBLE( sparcv9vis2 ) { static sparc_disassembler dasm(nullptr, 9, sparc_disassembler::vis_2); return dasm.dasm(buffer, pc, BIG_ENDIANIZE_INT32(*reinterpret_cast<const UINT32 *>(oprom))); } -CPU_DISASSEMBLE( sparcv9vis2p ) { static sparc_disassembler dasm(nullptr, 9, sparc_disassembler::vis_2p); return dasm.dasm(buffer, pc, BIG_ENDIANIZE_INT32(*reinterpret_cast<const UINT32 *>(oprom))); } -CPU_DISASSEMBLE( sparcv9vis3 ) { static sparc_disassembler dasm(nullptr, 9, sparc_disassembler::vis_3); return dasm.dasm(buffer, pc, BIG_ENDIANIZE_INT32(*reinterpret_cast<const UINT32 *>(oprom))); } -CPU_DISASSEMBLE( sparcv9vis3b ) { static sparc_disassembler dasm(nullptr, 9, sparc_disassembler::vis_3b); return dasm.dasm(buffer, pc, BIG_ENDIANIZE_INT32(*reinterpret_cast<const UINT32 *>(oprom))); } +CPU_DISASSEMBLE( sparcv7 ) { static sparc_disassembler dasm(nullptr, 7); return dasm.dasm(buffer, pc, big_endianize_int32(*reinterpret_cast<const UINT32 *>(oprom))); } +CPU_DISASSEMBLE( sparcv8 ) { static sparc_disassembler dasm(nullptr, 8); return dasm.dasm(buffer, pc, big_endianize_int32(*reinterpret_cast<const UINT32 *>(oprom))); } +CPU_DISASSEMBLE( sparcv9 ) { static sparc_disassembler dasm(nullptr, 9); return dasm.dasm(buffer, pc, big_endianize_int32(*reinterpret_cast<const UINT32 *>(oprom))); } +CPU_DISASSEMBLE( sparcv9vis1 ) { static sparc_disassembler dasm(nullptr, 9, sparc_disassembler::vis_1); return dasm.dasm(buffer, pc, big_endianize_int32(*reinterpret_cast<const UINT32 *>(oprom))); } +CPU_DISASSEMBLE( sparcv9vis2 ) { static sparc_disassembler dasm(nullptr, 9, sparc_disassembler::vis_2); return dasm.dasm(buffer, pc, big_endianize_int32(*reinterpret_cast<const UINT32 *>(oprom))); } +CPU_DISASSEMBLE( sparcv9vis2p ) { static sparc_disassembler dasm(nullptr, 9, sparc_disassembler::vis_2p); return dasm.dasm(buffer, pc, big_endianize_int32(*reinterpret_cast<const UINT32 *>(oprom))); } +CPU_DISASSEMBLE( sparcv9vis3 ) { static sparc_disassembler dasm(nullptr, 9, sparc_disassembler::vis_3); return dasm.dasm(buffer, pc, big_endianize_int32(*reinterpret_cast<const UINT32 *>(oprom))); } +CPU_DISASSEMBLE( sparcv9vis3b ) { static sparc_disassembler dasm(nullptr, 9, sparc_disassembler::vis_3b); return dasm.dasm(buffer, pc, big_endianize_int32(*reinterpret_cast<const UINT32 *>(oprom))); } static const dasm_table_entry dasm_table[] = |