mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-08 21:32:39 +00:00
Fix fpcmp infinite loop when comparing "29-266" with "29-268".
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46455 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
349c72a35d
commit
599ddf9a76
@ -20,11 +20,15 @@
|
||||
#include <cctype>
|
||||
using namespace llvm;
|
||||
|
||||
static bool isNumberChar(char C) {
|
||||
static bool isSignedChar(char C) {
|
||||
if (C == '+' || C == '-')
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool isExpoentChar(char C) {
|
||||
switch (C) {
|
||||
case '0': case '1': case '2': case '3': case '4':
|
||||
case '5': case '6': case '7': case '8': case '9':
|
||||
case '.': case '+': case '-':
|
||||
case 'D': // Strange exponential notation.
|
||||
case 'd': // Strange exponential notation.
|
||||
case 'e':
|
||||
@ -33,13 +37,25 @@ static bool isNumberChar(char C) {
|
||||
}
|
||||
}
|
||||
|
||||
static bool isNumberChar(char C) {
|
||||
switch (C) {
|
||||
case '0': case '1': case '2': case '3': case '4':
|
||||
case '5': case '6': case '7': case '8': case '9':
|
||||
case '.': return true;
|
||||
default: return isSignedChar(C) || isExpoentChar(C);
|
||||
}
|
||||
}
|
||||
|
||||
static char *BackupNumber(char *Pos, char *FirstChar) {
|
||||
// If we didn't stop in the middle of a number, don't backup.
|
||||
if (!isNumberChar(*Pos)) return Pos;
|
||||
|
||||
// Otherwise, return to the start of the number.
|
||||
while (Pos > FirstChar && isNumberChar(Pos[-1]))
|
||||
while (Pos > FirstChar && isNumberChar(Pos[-1])) {
|
||||
--Pos;
|
||||
if (Pos > FirstChar && isSignedChar(Pos[0]) && !isExpoentChar(Pos[-1]))
|
||||
break;
|
||||
}
|
||||
return Pos;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user