From 79cd1b2795241e23c5950f6ec7a7fe666d25ad70 Mon Sep 17 00:00:00 2001 From: eteo Date: Sat, 22 Apr 2006 06:45:59 +0000 Subject: 2006-04-21 Eugene Teo PR 1326 * translate.cxx (c_unparser::visit_binary_expression): Handle negative left and right shift count. --- ChangeLog | 6 ++++++ translate.cxx | 13 ++++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index f65efd14..4a2a5546 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-04-21 Eugene Teo + + PR 1326 + * translate.cxx (c_unparser::visit_binary_expression): Handle + negative left and right shift count. + 2006-04-21 Frank Ch. Eigler PR 953 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 == "%") { -- cgit