From c4a7efb9e0e4c8ded8afd503426744ad370c499c Mon Sep 17 00:00:00 2001 From: Alexandre Duret-Lutz Date: Sat, 4 Dec 2010 17:10:47 +0100 Subject: [PATCH] * src/ltlvisit/syntimpl.cc: Reduce the number of dynamic_cast<>s. --- ChangeLog | 4 ++++ src/ltlvisit/syntimpl.cc | 23 +++++++++++------------ 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1fc464767..f61f26855 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2010-12-04 Alexandre Duret-Lutz + + * src/ltlvisit/syntimpl.cc: Reduce the number of dynamic_cast<>s. + 2010-12-04 Alexandre Duret-Lutz Preliminary implementation of a tool to generate some interesting diff --git a/src/ltlvisit/syntimpl.cc b/src/ltlvisit/syntimpl.cc index cc0ff2fa6..7c2a51b78 100644 --- a/src/ltlvisit/syntimpl.cc +++ b/src/ltlvisit/syntimpl.cc @@ -59,7 +59,7 @@ namespace spot void visit(const atomic_prop* ap) { - if (dynamic_cast(f) == ap) + if (f == ap) result_ = true; } @@ -220,13 +220,12 @@ namespace spot } bool - special_case(const formula* f2) + special_case(const binop* f2) { const binop* fb = dynamic_cast(f); - const binop* f2b = dynamic_cast(f2); - if (fb && f2b && fb->op() == f2b->op() - && syntactic_implication(f2b->first(), fb->first()) - && syntactic_implication(f2b->second(), fb->second())) + if (fb && fb->op() == f2->op() + && syntactic_implication(f2->first(), fb->first()) + && syntactic_implication(f2->second(), fb->second())) return true; return false; } @@ -284,9 +283,9 @@ namespace spot case unop::F: { /* F(a) = true U a */ - const formula* tmp = binop::instance(binop::U, - constant::true_instance(), - f1->clone()); + const binop* tmp = binop::instance(binop::U, + constant::true_instance(), + f1->clone()); if (special_case(tmp)) { result_ = true; @@ -301,9 +300,9 @@ namespace spot case unop::G: { /* G(a) = false R a */ - const formula* tmp = binop::instance(binop::R, - constant::false_instance(), - f1->clone()); + const binop* tmp = binop::instance(binop::R, + constant::false_instance(), + f1->clone()); if (special_case(tmp)) { result_ = true;