Update parseDirective to use getImmediate even without hashtag
This commit is contained in:
parent
41fde09d75
commit
15c8482dd3
@ -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) {
|
||||||
|
|||||||
@ -96,10 +96,8 @@ 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) {
|
||||||
// Hex
|
// Hex
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user