mirror of
https://github.com/ZDoom/acc.git
synced 2025-02-14 15:41:17 +00:00
- Fixed: ACC's EvalFixedConstant() could overflow when adding the fractional part to
the integral part of the number. SVN r1611 (trunk)
This commit is contained in:
parent
9392539534
commit
4030849b1e
1 changed files with 3 additions and 3 deletions
6
token.c
6
token.c
|
@ -956,8 +956,8 @@ static void ProcessNumberToken(void)
|
||||||
|
|
||||||
static void EvalFixedConstant(int whole)
|
static void EvalFixedConstant(int whole)
|
||||||
{
|
{
|
||||||
int frac;
|
double frac;
|
||||||
int divisor;
|
double divisor;
|
||||||
|
|
||||||
frac = 0;
|
frac = 0;
|
||||||
divisor = 1;
|
divisor = 1;
|
||||||
|
@ -967,7 +967,7 @@ static void EvalFixedConstant(int whole)
|
||||||
divisor *= 10;
|
divisor *= 10;
|
||||||
NextChr();
|
NextChr();
|
||||||
}
|
}
|
||||||
tk_Number = (whole<<16)+((frac<<16)/divisor);
|
tk_Number = (whole<<16)+(int)(65536.0*frac/divisor);
|
||||||
tk_Token = TK_NUMBER;
|
tk_Token = TK_NUMBER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue