diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-12-28 10:39:44 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-12-28 10:39:44 -0800 |
commit | 493eed11c24fc51716a08df7b72d5f0021e6535e (patch) | |
tree | 47be247a230d7890e8a37788206e0220c87573c8 /src/relooper/Relooper.cpp | |
parent | 9e1c9c1577669424a9c7dee86b34f20ad6366c8e (diff) |
optimize relooper id counters1.8.0
Diffstat (limited to 'src/relooper/Relooper.cpp')
-rw-r--r-- | src/relooper/Relooper.cpp | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/relooper/Relooper.cpp b/src/relooper/Relooper.cpp index fc7b3ea7..70cf844b 100644 --- a/src/relooper/Relooper.cpp +++ b/src/relooper/Relooper.cpp @@ -101,9 +101,7 @@ void Branch::Render(Block *Target, bool SetLabel) { // Block -int Block::IdCounter = 1; // 0 is reserved for clearings - -Block::Block(const char *CodeInit, const char *BranchVarInit) : Parent(NULL), Id(Block::IdCounter++), IsCheckedMultipleEntry(false) { +Block::Block(const char *CodeInit, const char *BranchVarInit) : Parent(NULL), Id(-1), IsCheckedMultipleEntry(false) { Code = strdup(CodeInit); BranchVar = BranchVarInit ? strdup(BranchVarInit) : NULL; } @@ -273,10 +271,6 @@ void Block::Render(bool InLoop) { } } -// Shape - -int Shape::IdCounter = 0; - // MultipleShape void MultipleShape::RenderLoopPrefix() { @@ -360,7 +354,7 @@ void EmulatedShape::Render(bool InLoop) { // Relooper -Relooper::Relooper() : Root(NULL), Emulate(false) { +Relooper::Relooper() : Root(NULL), Emulate(false), BlockIdCounter(1), ShapeIdCounter(0) { // block ID 0 is reserved for clearings } Relooper::~Relooper() { @@ -369,6 +363,7 @@ Relooper::~Relooper() { } void Relooper::AddBlock(Block *New) { + New->Id = BlockIdCounter++; Blocks.push_back(New); } @@ -473,6 +468,7 @@ void Relooper::Calculate(Block *Entry) { // Add a shape to the list of shapes in this Relooper calculation void Notice(Shape *New) { + New->Id = Parent->ShapeIdCounter++; Parent->Shapes.push_back(New); } |