From f2565c463e418c7f5f35d659a5c9c5c137485a2d Mon Sep 17 00:00:00 2001 From: Ulya Trofimovich Date: Thu, 26 Mar 2015 16:45:57 +0000 Subject: [PATCH] A little code cleanup. --- re2c/go_construct.cc | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/re2c/go_construct.cc b/re2c/go_construct.cc index 04e8a481..75bdace0 100644 --- a/re2c/go_construct.cc +++ b/re2c/go_construct.cc @@ -37,10 +37,16 @@ Cond::Cond (const std::string & cmp, uint val) {} Binary::Binary (const Span * s, uint n, const State * next) - : cond (new Cond ("<=", s[n / 2 - 1].ub - 1)) - , thn (new If (n / 2 > 4 ? If::BINARY : If::LINEAR, &s[0], n / 2, next)) - , els (new If (n - n / 2 > 4 ? If::BINARY : If::LINEAR, &s[n / 2], n - n / 2, next)) -{} + : cond (NULL) + , thn (NULL) + , els (NULL) +{ + const uint l = n / 2; + const uint h = n - l; + cond = new Cond ("<=", s[l - 1].ub - 1); + thn = new If (l > 4 ? If::BINARY : If::LINEAR, &s[0], l, next); + els = new If (h > 4 ? If::BINARY : If::LINEAR, &s[l], h, next); +} Linear::Linear (const Span * s, uint n, const State * next) : branches () -- 2.40.0