Fixed floating point support in assembler.
This commit is contained in:
@@ -94,9 +94,9 @@ static uint64_t readParenExpression(const string &s, const map<string, Word> &d,
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int lexerBytes;
|
int lexerFloatBytes;
|
||||||
Obj *AsmReader::read(std::istream &input) {
|
Obj *AsmReader::read(std::istream &input) {
|
||||||
lexerBytes = wordSize;
|
lexerFloatBytes = wordSize;
|
||||||
FlexLexer *f = new yyFlexLexer(&input);
|
FlexLexer *f = new yyFlexLexer(&input);
|
||||||
Obj *o = new Obj();
|
Obj *o = new Obj();
|
||||||
std::vector<Chunk>::reverse_iterator cur;
|
std::vector<Chunk>::reverse_iterator cur;
|
||||||
|
|||||||
@@ -16,14 +16,14 @@
|
|||||||
#include "include/asm-tokens.h"
|
#include "include/asm-tokens.h"
|
||||||
#include "include/harpfloat.h"
|
#include "include/harpfloat.h"
|
||||||
|
|
||||||
extern int lexerBytes;
|
extern int lexerFloatBytes;
|
||||||
static int64_t read_number(const char *s) {
|
static int64_t read_number(const char *s) {
|
||||||
while (!isdigit(*s) && *s != '-' && *s != '+') s++;
|
while (!isdigit(*s) && *s != '-' && *s != '+') s++;
|
||||||
|
|
||||||
if (strchr(s, 'f') || strchr(s, '.')) {
|
if (strchr(s, 'f') && !strchr(s, 'x') || strchr(s, '.')) {
|
||||||
double d;
|
double d;
|
||||||
sscanf(s, "%f", &d);
|
sscanf(s, "%lf", &d);
|
||||||
return Harp::Word_u(Harp::Float(d, lexerBytes));
|
return Harp::Word_u(Harp::Float(d, lexerFloatBytes));
|
||||||
} else {
|
} else {
|
||||||
long long u;
|
long long u;
|
||||||
sscanf(s, "%lli", &u);
|
sscanf(s, "%lli", &u);
|
||||||
|
|||||||
Reference in New Issue
Block a user