Log base 2 operator in assembler.

This commit is contained in:
chad
2013-10-08 02:20:32 -04:00
parent 2392401f4c
commit bd451a36af
2 changed files with 4 additions and 2 deletions

View File

@@ -13,6 +13,7 @@
#include <cctype>
#include <cstdio>
#include <cmath>
#include <map>
@@ -76,8 +77,9 @@ static uint64_t readParenExpression(const string &s, const map<string, Word> &d,
if (s[i] == '&') return rPE(s, d, start, i) & rPE(s, d, i+1, end);
}
// Unary -
// Unary operators
if (s[start] == '-') return -rPE(s, d, start+1, end);
if (s[start] == '`') return log2(rPE(s, d, start+1, end));
if (isdigit(s[start])) {
unsigned long long u;

View File

@@ -53,7 +53,7 @@ octnum 0[0-7]*
floatnum ([0-9]+f|[0-9]*\.[0-9]+)
num [+-]?({decnum}|{hexnum}|{octnum}|{floatnum})
space [ \t]*
peoperator ("+"|"-"|"*"|"/"|"%"|"&"|"|"|"^"|"<<"|">>")
peoperator ("+"|"-"|"*"|"/"|"%"|"&"|"|"|"^"|"<<"|">>"|"`")
parenexp "("({num}|{sym}|{peoperator}|{space}|"("|")")+")"
endl \r?\n