Log base 2 operator in assembler.
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user