code = BPF_LSH;
else if (e->op == ">>")
code = BPF_ARSH;
+ else if (e->op == ">>>")
+ code = BPF_RSH;
else if (e->op == "/")
code = BPF_DIV;
else if (e->op == "%")
\subsubsection{Binary numeric operators}
\index{binary}
-\texttt{{*} / \% + - >\,{}> <\,{}< \& \textasciicircum{}
+\texttt{{*} / \% + - >\,{}> >\,{}>\,{}> <\,{}< \& \textasciicircum{}
| \&\& ||}
\subsubsection{Binary string operators}
BINOP (or, binary_expression, |);
BINOP (plus, binary_expression, +);
BINOP (shl, binary_expression, <<);
- BINOP (shr, binary_expression, u>>);
+ BINOP (shr, binary_expression, >>>);
BINOP (shra, binary_expression, >>);
BINOP (xor, binary_expression, ^);
BINOP (div, binary_expression, /);
// match all valid operators, in decreasing size order
if ((c == '<' && c2 == '<' && c3 == '<') ||
+ (c == '>' && c2 == '>' && c3 == '>') ||
(c == '<' && c2 == '<' && c3 == '=') ||
(c == '>' && c2 == '>' && c3 == '='))
{
const token* t = peek ();
while (t && t->type == tok_operator &&
- (t->content == "<<" || t->content == ">>"))
+ (t->content == "<<" || t->content == ">>" || t->content == ">>>"))
{
binary_expression* e = new binary_expression;
e->left = op1;
e->right->visit (this);
o->line() << ") & 63)";
}
+ else if (e->op == ">>>")
+ {
+ o->line() << "(int64_t)((uint64_t)(";
+ e->left->visit (this);
+ o->line() << ") >> ((";
+ e->right->visit (this);
+ o->line() << ") & 63))";
+ }
else if (e->op == "/" ||
e->op == "%")
{
o->newline(-1) << "})";
}
else
- throw SEMANTIC_ERROR (_("operator not yet implemented"), e->tok);
+ throw SEMANTIC_ERROR (_F("operator %s not yet implemented", string(e->op).c_str()), e->tok);
}