Changed the sharc disassembler to use 'std::ostream &' internally

This commit is contained in:
Nathan Woods 2016-11-17 19:47:55 -05:00
parent 1a9cdb5c7a
commit 0e2ca126ef

View File

@ -1176,7 +1176,7 @@ static void build_dasm_table(void)
}
}
static uint32_t sharc_dasm_one(char *buffer, offs_t pc, uint64_t opcode)
static uint32_t sharc_dasm_one(std::ostream &stream, offs_t pc, uint64_t opcode)
{
#define DEFAULT_DASM_WIDTH (64)
@ -1198,14 +1198,24 @@ static uint32_t sharc_dasm_one(char *buffer, offs_t pc, uint64_t opcode)
flags = (*sharcdasm_table[op])(pc, opcode);
for (i=0; i < DEFAULT_DASM_WIDTH; i++)
for (i=0; i < DEFAULT_DASM_WIDTH && dasm_buffer[i]; i++)
{
buffer[i] = dasm_buffer[i];
stream << dasm_buffer[i];
}
return flags;
}
static uint32_t sharc_dasm_one(char *buffer, offs_t pc, uint64_t opcode)
{
std::ostringstream stream;
uint32_t result = sharc_dasm_one(stream, pc, opcode);
std::string stream_str = stream.str();
strcpy(buffer, stream_str.c_str());
return result;
}
CPU_DISASSEMBLE( sharc )
{
uint64_t op;