mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
Fix a bug where we would consider " .99" and "1.0" different because of the
leading whitespace. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20647 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -18,6 +18,7 @@
|
|||||||
#include "llvm/ADT/StringExtras.h"
|
#include "llvm/ADT/StringExtras.h"
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
#include <cctype>
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
static bool isNumberChar(char C) {
|
static bool isNumberChar(char C) {
|
||||||
@@ -47,6 +48,14 @@ static bool CompareNumbers(char *&F1P, char *&F2P, char *F1End, char *F2End,
|
|||||||
std::string *ErrorMsg) {
|
std::string *ErrorMsg) {
|
||||||
char *F1NumEnd, *F2NumEnd;
|
char *F1NumEnd, *F2NumEnd;
|
||||||
double V1 = 0.0, V2 = 0.0;
|
double V1 = 0.0, V2 = 0.0;
|
||||||
|
|
||||||
|
// If one of the positions is at a space and the other isn't, chomp up 'til
|
||||||
|
// the end of the space.
|
||||||
|
while (isspace(*F1P) && F1P != F1End)
|
||||||
|
++F1P;
|
||||||
|
while (isspace(*F2P) && F2P != F2End)
|
||||||
|
++F2P;
|
||||||
|
|
||||||
// If we stop on numbers, compare their difference.
|
// If we stop on numbers, compare their difference.
|
||||||
if (isNumberChar(*F1P) && isNumberChar(*F2P)) {
|
if (isNumberChar(*F1P) && isNumberChar(*F2P)) {
|
||||||
V1 = strtod(F1P, &F1NumEnd);
|
V1 = strtod(F1P, &F1NumEnd);
|
||||||
|
Reference in New Issue
Block a user