Update parseDirective to use getImmediate even without hashtag

This commit is contained in:
sBubshait 2024-06-20 04:49:56 +01:00
parent 41fde09d75
commit 15c8482dd3
2 changed files with 3 additions and 8 deletions

View File

@ -130,10 +130,7 @@ static void parse_instruction(char asmLine[], a64inst_instruction *instr) {
} }
static void parseDirective(a64inst_instruction *instr, char *opcode, char *tokens[], int tokensCount) { static void parseDirective(a64inst_instruction *instr, char *opcode, char *tokens[], int tokensCount) {
char intValue[strlen(tokens[1]) + 1]; instr->data.DirectiveData.value = getImmediate(tokens[1]);
*intValue = '#';
strcpy(intValue + 1, tokens[1]);
instr->data.DirectiveData.value = getImmediate(intValue);
} }
static void parseSingleTransfer(a64inst_instruction *instr, char *opcode, char *tokens[], int tokensCount) { static void parseSingleTransfer(a64inst_instruction *instr, char *opcode, char *tokens[], int tokensCount) {

View File

@ -96,9 +96,7 @@ int getImmediate(char *str) {
return 0; return 0;
} }
if (str[0] != '#') if (str[0] == '#')
return 0;
str++; // skip # str++; // skip #
if (strncmp(str, "0x", 2) == 0 || strncmp(str, "0X", 3) == 0) { if (strncmp(str, "0x", 2) == 0 || strncmp(str, "0X", 3) == 0) {