Use standardised signed version of word type from base.h
This commit is contained in:
@@ -79,9 +79,7 @@ perr_t parse_word(token_t token, word *ret)
|
|||||||
if (is_negative)
|
if (is_negative)
|
||||||
{
|
{
|
||||||
char *end = NULL;
|
char *end = NULL;
|
||||||
// TODO: Make a standardised type of the same size as word in
|
s_word i = strtoll(token.str, &end, 0);
|
||||||
// base.h
|
|
||||||
int64_t i = strtoll(token.str, &end, 0);
|
|
||||||
if (!(end && end[0] == '\0'))
|
if (!(end && end[0] == '\0'))
|
||||||
return PERR_NOT_A_NUMBER;
|
return PERR_NOT_A_NUMBER;
|
||||||
else if (errno == ERANGE)
|
else if (errno == ERANGE)
|
||||||
|
|||||||
@@ -197,7 +197,7 @@ err_t vm_execute(vm_t *vm)
|
|||||||
printf("0x%x", datum.as_byte);
|
printf("0x%x", datum.as_byte);
|
||||||
break;
|
break;
|
||||||
case TYPE_INT: {
|
case TYPE_INT: {
|
||||||
int32_t i = 0;
|
s_hword i = 0;
|
||||||
memcpy(&i, &datum.as_hword, HWORD_SIZE);
|
memcpy(&i, &datum.as_hword, HWORD_SIZE);
|
||||||
printf("%" PRId32, i);
|
printf("%" PRId32, i);
|
||||||
break;
|
break;
|
||||||
@@ -206,7 +206,7 @@ err_t vm_execute(vm_t *vm)
|
|||||||
printf("%" PRIu32, datum.as_hword);
|
printf("%" PRIu32, datum.as_hword);
|
||||||
break;
|
break;
|
||||||
case TYPE_LONG: {
|
case TYPE_LONG: {
|
||||||
int64_t i = 0;
|
s_word i = 0;
|
||||||
memcpy(&i, &datum.as_word, WORD_SIZE);
|
memcpy(&i, &datum.as_word, WORD_SIZE);
|
||||||
printf("%" PRId64, i);
|
printf("%" PRId64, i);
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user