@@ -20,23 +20,21 @@ double* CliqueStack::setup(Int64 clique_size, bool& reallocation) {
2020 assert (!workspace_ && !worksize_);
2121 reallocation = false ;
2222
23- if (!stack_. empty () ) {
23+ if (clique_size > 0 ) {
2424 // This should not trigger reallocation, because the resize in init is done
2525 // with the maximum possible size of the stack.
2626 if (top_ + clique_size > stack_.size ()) {
2727 reallocation = true ;
2828 stack_.resize (top_ + clique_size, 0.0 );
2929 }
3030
31- if (clique_size > 0 ) {
32- // accessing stack[top] is valid only if the clique is not empty,
33- // otherwise it may be out of bounds.
34- workspace_ = &stack_[top_];
35- worksize_ = clique_size;
31+ // accessing stack[top] is valid only if the clique is not empty,
32+ // otherwise it may be out of bounds.
33+ workspace_ = &stack_[top_];
34+ worksize_ = clique_size;
3635
37- // initialize workspace to zero
38- std::memset (workspace_, 0 , worksize_ * sizeof (double ));
39- }
36+ // initialize workspace to zero
37+ std::memset (workspace_, 0 , worksize_ * sizeof (double ));
4038 }
4139
4240 return workspace_;
@@ -67,7 +65,7 @@ void CliqueStack::popChild() {
6765void CliqueStack::pushWork (Int sn) {
6866 // Put the content of the workspace at the top of the stack
6967
70- if (!stack_. empty () ) {
68+ if (worksize_ > 0 ) {
7169 // stack_[top_] has lower address than workspace, so no need to resize.
7270 // workspace_ and stack_[top_] do not overlap, so use memcpy
7371 std::memcpy (&stack_[top_], workspace_, worksize_ * sizeof (double ));
0 commit comments