summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Kanios <keith@kanios.net>2007-10-13 07:09:22 -0700
committerH. Peter Anvin <hpa@zytor.com>2007-10-13 07:09:22 -0700
commita5fc6467ab3bdd538a4731fdb0fc281bb599dc9e (patch)
treedd47a70955918240ddf17b73a6deaadc1453e321
parentb263b504bc6a56dbb56ba8afff1a0c2d3869d64b (diff)
downloadnasm-a5fc6467ab3bdd538a4731fdb0fc281bb599dc9e.tar.gz
nasm-a5fc6467ab3bdd538a4731fdb0fc281bb599dc9e.tar.bz2
nasm-a5fc6467ab3bdd538a4731fdb0fc281bb599dc9e.zip
Fix 32-bit types in preproc.c and eval.c
Fix 32-bit types in preproc.c and eval.c that should have been 64-bit types. This allows %assign to work correctly with 64-bit integers.
-rw-r--r--eval.c32
-rw-r--r--preproc.c6
2 files changed, 19 insertions, 19 deletions
diff --git a/eval.c b/eval.c
index 65290f2..423b08d 100644
--- a/eval.c
+++ b/eval.c
@@ -120,7 +120,7 @@ static expr *add_vectors(expr * p, expr * q)
addtotemp(p->type, p->value);
lasttype = p++->type;
} else { /* *p and *q have same type */
- int32_t sum = p->value + q->value;
+ int64_t sum = p->value + q->value;
if (sum)
addtotemp(p->type, sum);
lasttype = p->type;
@@ -154,7 +154,7 @@ static expr *add_vectors(expr * p, expr * q)
* multiplied. This allows [eax*1+ebx] to hint EBX rather than EAX
* as the base register.
*/
-static expr *scalar_mult(expr * vect, int32_t scalar, int affect_hints)
+static expr *scalar_mult(expr * vect, int64_t scalar, int affect_hints)
{
expr *p = vect;
@@ -170,7 +170,7 @@ static expr *scalar_mult(expr * vect, int32_t scalar, int affect_hints)
return vect;
}
-static expr *scalarvect(int32_t scalar)
+static expr *scalarvect(int64_t scalar)
{
begintemp();
addtotemp(EXPR_SIMPLE, scalar);
@@ -283,7 +283,7 @@ static expr *rexp0(int critical)
if (is_just_unknown(e) || is_just_unknown(f))
e = unknown_expr();
else
- e = scalarvect((int32_t)(reloc_value(e) || reloc_value(f)));
+ e = scalarvect((int64_t)(reloc_value(e) || reloc_value(f)));
}
return e;
}
@@ -310,7 +310,7 @@ static expr *rexp1(int critical)
if (is_just_unknown(e) || is_just_unknown(f))
e = unknown_expr();
else
- e = scalarvect((int32_t)(!reloc_value(e) ^ !reloc_value(f)));
+ e = scalarvect((int64_t)(!reloc_value(e) ^ !reloc_value(f)));
}
return e;
}
@@ -335,7 +335,7 @@ static expr *rexp2(int critical)
if (is_just_unknown(e) || is_just_unknown(f))
e = unknown_expr();
else
- e = scalarvect((int32_t)(reloc_value(e) && reloc_value(f)));
+ e = scalarvect((int64_t)(reloc_value(e) && reloc_value(f)));
}
return e;
}
@@ -343,7 +343,7 @@ static expr *rexp2(int critical)
static expr *rexp3(int critical)
{
expr *e, *f;
- int32_t v;
+ int64_t v;
e = expr0(critical);
if (!e)
@@ -502,7 +502,7 @@ static expr *expr3(int critical)
e = scalarvect(reloc_value(e) << reloc_value(f));
break;
case TOKEN_SHR:
- e = scalarvect(((uint32_t)reloc_value(e)) >>
+ e = scalarvect(((uint64_t)reloc_value(e)) >>
reloc_value(f));
break;
}
@@ -577,29 +577,29 @@ static expr *expr5(int critical)
if (is_just_unknown(e) || is_just_unknown(f))
e = unknown_expr();
else
- e = scalarvect(((uint32_t)reloc_value(e)) /
- ((uint32_t)reloc_value(f)));
+ e = scalarvect(((uint64_t)reloc_value(e)) /
+ ((uint64_t)reloc_value(f)));
break;
case '%':
if (is_just_unknown(e) || is_just_unknown(f))
e = unknown_expr();
else
- e = scalarvect(((uint32_t)reloc_value(e)) %
- ((uint32_t)reloc_value(f)));
+ e = scalarvect(((uint64_t)reloc_value(e)) %
+ ((uint64_t)reloc_value(f)));
break;
case TOKEN_SDIV:
if (is_just_unknown(e) || is_just_unknown(f))
e = unknown_expr();
else
- e = scalarvect(((int32_t)reloc_value(e)) /
- ((int32_t)reloc_value(f)));
+ e = scalarvect(((int64_t)reloc_value(e)) /
+ ((int64_t)reloc_value(f)));
break;
case TOKEN_SMOD:
if (is_just_unknown(e) || is_just_unknown(f))
e = unknown_expr();
else
- e = scalarvect(((int32_t)reloc_value(e)) %
- ((int32_t)reloc_value(f)));
+ e = scalarvect(((int64_t)reloc_value(e)) %
+ ((int64_t)reloc_value(f)));
break;
}
}
diff --git a/preproc.c b/preproc.c
index bcef30e..48e7207 100644
--- a/preproc.c
+++ b/preproc.c
@@ -386,7 +386,7 @@ static Token *expand_mmac_params(Token * tline);
static Token *expand_smacro(Token * tline);
static Token *expand_id(Token * tline);
static Context *get_ctx(char *name, bool all_contexts);
-static void make_tok_num(Token * tok, int32_t val);
+static void make_tok_num(Token * tok, int64_t val);
static void error(int severity, const char *fmt, ...);
static void *new_Block(size_t size);
static void delete_Blocks(void);
@@ -4005,10 +4005,10 @@ void pp_extra_stdmac(const char **macros)
extrastdmac = macros;
}
-static void make_tok_num(Token * tok, int32_t val)
+static void make_tok_num(Token * tok, int64_t val)
{
char numbuf[20];
- snprintf(numbuf, sizeof(numbuf), "%"PRId32"", val);
+ snprintf(numbuf, sizeof(numbuf), "%"PRId64"", val);
tok->text = nasm_strdup(numbuf);
tok->type = TOK_NUMBER;
}