diff --git a/src/obj.cpp b/src/obj.cpp index 92e5abf9..d9b1679f 100644 --- a/src/obj.cpp +++ b/src/obj.cpp @@ -13,6 +13,7 @@ #include #include +#include #include @@ -76,8 +77,9 @@ static uint64_t readParenExpression(const string &s, const map &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; diff --git a/src/scanner.lex b/src/scanner.lex index 0b935d97..b76205e1 100644 --- a/src/scanner.lex +++ b/src/scanner.lex @@ -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