mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-26 07:45:33 +01:00
DSPAssembler: Slightly improve readability of AssemblePass
This should result in no behavior differences.
This commit is contained in:
parent
c34a738b4c
commit
e7f6e19c61
@ -751,7 +751,7 @@ void DSPAssembler::InitPass(int pass)
|
|||||||
|
|
||||||
bool DSPAssembler::AssemblePass(const std::string& text, int pass)
|
bool DSPAssembler::AssemblePass(const std::string& text, int pass)
|
||||||
{
|
{
|
||||||
int disable_text = 0; // modified by Hermes
|
bool disable_text = false; // modified by Hermes
|
||||||
|
|
||||||
std::istringstream fsrc(text);
|
std::istringstream fsrc(text);
|
||||||
|
|
||||||
@ -781,10 +781,10 @@ bool DSPAssembler::AssemblePass(const std::string& text, int pass)
|
|||||||
// modified by Hermes : added // and /* */ for long commentaries
|
// modified by Hermes : added // and /* */ for long commentaries
|
||||||
if (c == '/')
|
if (c == '/')
|
||||||
{
|
{
|
||||||
if (i < 1023)
|
if (i + 1 < LINEBUF_SIZE)
|
||||||
{
|
{
|
||||||
if (line[i + 1] == '/')
|
if (line[i + 1] == '/')
|
||||||
c = 0x00;
|
c = '\0';
|
||||||
else if (line[i + 1] == '*')
|
else if (line[i + 1] == '*')
|
||||||
{
|
{
|
||||||
// toggle comment mode.
|
// toggle comment mode.
|
||||||
@ -794,28 +794,28 @@ bool DSPAssembler::AssemblePass(const std::string& text, int pass)
|
|||||||
}
|
}
|
||||||
else if (c == '*')
|
else if (c == '*')
|
||||||
{
|
{
|
||||||
if (i < 1023 && line[i + 1] == '/' && disable_text)
|
if (i + 1 < LINEBUF_SIZE && line[i + 1] == '/' && disable_text)
|
||||||
{
|
{
|
||||||
disable_text = 0;
|
disable_text = false;
|
||||||
c = 32;
|
c = ' ';
|
||||||
line[i + 1] = 32;
|
line[i + 1] = ' ';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// turn text into spaces if disable_text is on (in a comment).
|
// turn text into spaces if disable_text is on (in a comment).
|
||||||
if (disable_text && ((unsigned char)c) > 32)
|
if (disable_text && ((unsigned char)c) > ' ')
|
||||||
c = 32;
|
c = ' ';
|
||||||
|
|
||||||
if (c == 0x0a || c == 0x0d || c == ';')
|
if (c == '\r' || c == '\n' || c == ';')
|
||||||
c = 0x00;
|
c = '\0';
|
||||||
if (c == 0x09) // tabs to spaces
|
if (c == '\t') // tabs to spaces
|
||||||
c = ' ';
|
c = ' ';
|
||||||
if (c == '"')
|
if (c == '"')
|
||||||
upper = !upper;
|
upper = !upper;
|
||||||
if (upper && c >= 'a' && c <= 'z') // convert to uppercase
|
if (upper && c >= 'a' && c <= 'z') // convert to uppercase
|
||||||
c = c - 'a' + 'A';
|
c = c - 'a' + 'A';
|
||||||
line[i] = c;
|
line[i] = c;
|
||||||
if (c == 0)
|
if (c == '\0')
|
||||||
break; // modified by Hermes
|
break; // modified by Hermes
|
||||||
}
|
}
|
||||||
char* ptr = line;
|
char* ptr = line;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user