diff options
Diffstat (limited to 'translate.cxx')
-rw-r--r-- | translate.cxx | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/translate.cxx b/translate.cxx index e0b1f8aa..83d6dd93 100644 --- a/translate.cxx +++ b/translate.cxx @@ -2468,9 +2468,7 @@ c_unparser::visit_binary_expression (binary_expression* e) e->op == "*" || e->op == "&" || e->op == "|" || - e->op == "^" || - e->op == "<<" || - e->op == ">>") + e->op == "^") { o->line() << "(("; e->left->visit (this); @@ -2478,6 +2476,15 @@ c_unparser::visit_binary_expression (binary_expression* e) e->right->visit (this); o->line() << "))"; } + else if (e->op == ">>" || + e->op == "<<") + { + o->line() << "(("; + e->left->visit (this); + o->line() << ") " << e->op << "max(min("; + e->right->visit (this); + o->line() << ", (int64_t)64LL), (int64_t)0LL))"; // between 0 and 64 + } else if (e->op == "/" || e->op == "%") { |