Skip to content

Commit

Permalink
Fixing for Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
msoos committed Jan 28, 2024
1 parent 535b43e commit 866025c
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 48 deletions.
12 changes: 6 additions & 6 deletions src/bliss/bliss.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
/*
Copyright (c) 2003-2015 Tommi Junttila
Released under the GNU Lesser General Public License version 3.
This file is part of bliss.
bliss is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, version 3 of the License.
Expand Down Expand Up @@ -55,7 +55,7 @@ static void usage(FILE* const fp, const char* argv0)
program_name++;
else
program_name = argv0;
if (!program_name or *program_name == 0)
if (!program_name || *program_name == 0)
program_name = "bliss";

fprintf(fp,
Expand Down Expand Up @@ -96,7 +96,7 @@ static void parse_options(const int argc, const char** argv)
for (int i = 1; i < argc; i++) {
if (strcmp(argv[i], "-can") == 0)
opt_canonize = true;
else if ((strncmp(argv[i], "-ocan=", 6) == 0) and
else if ((strncmp(argv[i], "-ocan=", 6) == 0) &&
(strlen(argv[i]) > 6)) {
opt_canonize = true;
opt_output_can_file = argv[i] + 6;
Expand All @@ -112,7 +112,7 @@ static void parse_options(const int argc, const char** argv)
opt_use_component_recursion = false;
else if (strcmp(argv[i], "-cr=y") == 0)
opt_use_component_recursion = true;
else if ((strncmp(argv[i], "-sh=", 4) == 0) and (strlen(argv[i]) > 4)) {
else if ((strncmp(argv[i], "-sh=", 4) == 0) && (strlen(argv[i]) > 4)) {
opt_splitting_heuristics = argv[i] + 4;
} else if (strcmp(argv[i], "-version") == 0) {
fprintf(stdout, "bliss version %s\n", bliss::version);
Expand Down Expand Up @@ -268,7 +268,7 @@ int main(const int argc, const char** argv)
}

/* Output search statistics */
if (verbose_level > 0 and verbstr)
if (verbose_level > 0 && verbstr)
stats.print(verbstr);

if (verbose_level > 0) {
Expand Down
84 changes: 42 additions & 42 deletions src/bliss/graph.cc
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,7 @@ void AbstractGraph::search(const bool canonical, Stats& stats)
if (opt_use_comprec) {
CR_CEP& cep = cr_cep_stack[current_node.cr_cep_index];
if (cep.first_checked == true &&
current_node.fp_extendable == TreeNode::MAYBE and
current_node.fp_extendable == TreeNode::MAYBE &&
!search_stack[cep.creation_level].fp_on) {
current_node.fp_extendable = TreeNode::NO;
}
Expand All @@ -812,7 +812,7 @@ void AbstractGraph::search(const bool canonical, Stats& stats)
continue;
}
if (current_node.fp_extendable == TreeNode::NO &&
(!canonical or current_node.cmp_to_best_path < 0)) {
(!canonical || current_node.cmp_to_best_path < 0)) {
if (opt_use_failure_recording) {
TreeNode& parent_node = search_stack[current_level - 1];
if (parent_node.fp_on)
Expand Down Expand Up @@ -913,7 +913,7 @@ void AbstractGraph::search(const bool canonical, Stats& stats)
* a minimal orbit representative w.r.t. first_path_orbits */
for (unsigned int i = cell->length; i > 0; i--, ep++) {
if ((int)(*ep) > current_node.split_element &&
*ep < next_split_element and
*ep < next_split_element &&
first_path_orbits.is_minimal_representative(*ep)) {
next_split_element = *ep;
//next_split_element_pos = ep;
Expand All @@ -924,9 +924,9 @@ void AbstractGraph::search(const bool canonical, Stats& stats)
* a minimal orbit representative w.r.t. best_path_orbits */
for (unsigned int i = cell->length; i > 0; i--, ep++) {
if ((int)(*ep) > current_node.split_element &&
*ep < next_split_element and
best_path_orbits.is_minimal_representative(*ep) and
(!opt_use_long_prune or
*ep < next_split_element &&
best_path_orbits.is_minimal_representative(*ep) &&
(!opt_use_long_prune ||
current_node.long_prune_redundant.find(*ep) ==
current_node.long_prune_redundant.end())) {
next_split_element = *ep;
Expand All @@ -937,8 +937,8 @@ void AbstractGraph::search(const bool canonical, Stats& stats)
/* Find the next larger splitting element */
for (unsigned int i = cell->length; i > 0; i--, ep++) {
if ((int)(*ep) > current_node.split_element &&
*ep < next_split_element and
(!opt_use_long_prune or
*ep < next_split_element &&
(!opt_use_long_prune ||
current_node.long_prune_redundant.find(*ep) ==
current_node.long_prune_redundant.end())) {
next_split_element = *ep;
Expand Down Expand Up @@ -1090,7 +1090,7 @@ void AbstractGraph::search(const bool canonical, Stats& stats)
* if canonical labeling is desired, also worse than the
* current best path */
if (refine_equal_to_first == false &&
(!canonical or (refine_cmp_to_best < 0))) {
(!canonical || (refine_cmp_to_best < 0))) {
/* Yes, backtrack */
stats.nof_bad_nodes++;
if (current_node.fp_cert_equal == true &&
Expand Down Expand Up @@ -1125,8 +1125,8 @@ void AbstractGraph::search(const bool canonical, Stats& stats)
child_node.in_best_path = false;

child_node.fp_cert_equal = refine_equal_to_first;
if (current_node.fp_extendable == TreeNode::NO or
(current_node.fp_extendable == TreeNode::MAYBE and
if (current_node.fp_extendable == TreeNode::NO ||
(current_node.fp_extendable == TreeNode::MAYBE &&
child_node.fp_cert_equal == false))
child_node.fp_extendable = TreeNode::NO;
else
Expand Down Expand Up @@ -1247,7 +1247,7 @@ void AbstractGraph::search(const bool canonical, Stats& stats)
CR_CEP& cep = cr_cep_stack[cr_cep_index];

/* First, compare with respect to the first path */
if (first_path_info.empty() or child_node.fp_cert_equal) {
if (first_path_info.empty() || child_node.fp_cert_equal) {
if (cep.first_checked == false) {
/* First time, go to the next component */
cep.first_checked = true;
Expand Down Expand Up @@ -1392,7 +1392,7 @@ void AbstractGraph::search(const bool canonical, Stats& stats)
// cr_cep_stack[cr_cep_index].discrete_cell_limit)
if (nucr_find_first_component(cr_level, cr_component,
cr_component_elements,
next_split_cell) == true and
next_split_cell) == true &&
p.nof_discrete_cells() + cr_component_elements <
cr_cep_stack[cr_cep_index].discrete_cell_limit) {
const unsigned int next_cr_level =
Expand Down Expand Up @@ -2309,7 +2309,7 @@ bool Digraph::split_neighbourhood_of_cell(Partition::Cell* const cell)
cert_add_redundant(CERT_SPLIT, c->first, c->length);
/* No need to continue? */
if (refine_compare_certificate &&
(refine_equal_to_first == false) and
(refine_equal_to_first == false) &&
(refine_cmp_to_best < 0))
goto worse_exit;
}
Expand Down Expand Up @@ -2371,7 +2371,7 @@ bool Digraph::split_neighbourhood_of_cell(Partition::Cell* const cell)
cert_add_redundant(CERT_SPLIT, c->first, c->length);
/* No need to continue? */
if (refine_compare_certificate &&
(refine_equal_to_first == false) and
(refine_equal_to_first == false) &&
(refine_cmp_to_best < 0))
goto worse_exit;
}
Expand Down Expand Up @@ -2545,7 +2545,7 @@ bool Digraph::split_neighbourhood_of_unit_cell(Partition::Cell* const unit_cell)
cert_add(CERT_EDGE, unit_cell->first, i);
/* No need to continue? */
if (refine_compare_certificate &&
(refine_equal_to_first == false) and
(refine_equal_to_first == false) &&
(refine_cmp_to_best < 0))
goto worse_exit;
}
Expand Down Expand Up @@ -2662,7 +2662,7 @@ bool Digraph::split_neighbourhood_of_unit_cell(Partition::Cell* const unit_cell)
cert_add(CERT_EDGE, i, unit_cell->first);
/* No need to continue? */
if (refine_compare_certificate &&
(refine_equal_to_first == false) and
(refine_equal_to_first == false) &&
(refine_cmp_to_best < 0))
goto worse_exit;
}
Expand Down Expand Up @@ -3025,7 +3025,7 @@ Partition::Cell* Digraph::sh_first_smallest_max_neighbours()
neighbour_cell->max_ival = 0;
}

if ((value > best_value) or
if ((value > best_value) ||
(value == best_value && cell->length < best_size)) {
best_value = value;
best_size = cell->length;
Expand Down Expand Up @@ -3418,39 +3418,39 @@ bool Digraph::nucr_find_first_component(const unsigned int level,
/*| Phase 3: splitting heuristics */
switch (sh) {
case shs_f:
if (sh_return == 0 or cell->first <= sh_first) {
if (sh_return == 0 || cell->first <= sh_first) {
sh_return = cell;
sh_first = cell->first;
}
break;
case shs_fs:
if (sh_return == 0 or cell->length < sh_size or
if (sh_return == 0 || cell->length < sh_size ||
(cell->length == sh_size && cell->first <= sh_first)) {
sh_return = cell;
sh_first = cell->first;
sh_size = cell->length;
}
break;
case shs_fl:
if (sh_return == 0 or cell->length > sh_size or
if (sh_return == 0 || cell->length > sh_size ||
(cell->length == sh_size && cell->first <= sh_first)) {
sh_return = cell;
sh_first = cell->first;
sh_size = cell->length;
}
break;
case shs_fm:
if (sh_return == 0 or nuconn > sh_nuconn or
if (sh_return == 0 || nuconn > sh_nuconn ||
(nuconn == sh_nuconn && cell->first <= sh_first)) {
sh_return = cell;
sh_first = cell->first;
sh_nuconn = nuconn;
}
break;
case shs_fsm:
if (sh_return == 0 or nuconn > sh_nuconn or
(nuconn == sh_nuconn and
(cell->length < sh_size or
if (sh_return == 0 || nuconn > sh_nuconn ||
(nuconn == sh_nuconn &&
(cell->length < sh_size ||
(cell->length == sh_size && cell->first <= sh_first)))) {
sh_return = cell;
sh_first = cell->first;
Expand All @@ -3459,9 +3459,9 @@ bool Digraph::nucr_find_first_component(const unsigned int level,
}
break;
case shs_flm:
if (sh_return == 0 or nuconn > sh_nuconn or
(nuconn == sh_nuconn and
(cell->length > sh_size or
if (sh_return == 0 || nuconn > sh_nuconn ||
(nuconn == sh_nuconn &&
(cell->length > sh_size ||
(cell->length == sh_size && cell->first <= sh_first)))) {
sh_return = cell;
sh_first = cell->first;
Expand Down Expand Up @@ -4098,7 +4098,7 @@ bool Graph::split_neighbourhood_of_cell(Partition::Cell* const cell)
cert_add_redundant(CERT_SPLIT, c->first, c->length);
/* No need to continue? */
if (refine_compare_certificate &&
(refine_equal_to_first == false) and
(refine_equal_to_first == false) &&
(refine_cmp_to_best < 0))
goto worse_exit;
}
Expand Down Expand Up @@ -4266,7 +4266,7 @@ bool Graph::split_neighbourhood_of_unit_cell(Partition::Cell* const unit_cell)
cert_add(CERT_EDGE, unit_cell->first, i);
/* No need to continue? */
if (refine_compare_certificate &&
(refine_equal_to_first == false) and
(refine_equal_to_first == false) &&
(refine_cmp_to_best < 0))
goto worse_exit;
}
Expand Down Expand Up @@ -4542,7 +4542,7 @@ Partition::Cell* Graph::sh_first_smallest_max_neighbours()
value++;
neighbour_cell->max_ival = 0;
}
if ((value > best_value) or
if ((value > best_value) ||
(value == best_value && cell->length < best_size)) {
best_value = value;
best_size = cell->length;
Expand Down Expand Up @@ -4588,7 +4588,7 @@ Partition::Cell* Graph::sh_first_largest_max_neighbours()
value++;
neighbour_cell->max_ival = 0;
}
if ((value > best_value) or
if ((value > best_value) ||
(value == best_value && cell->length > best_size)) {
best_value = value;
best_size = cell->length;
Expand Down Expand Up @@ -4826,39 +4826,39 @@ bool Graph::nucr_find_first_component(const unsigned int level,

switch (sh) {
case shs_f:
if (sh_return == 0 or cell->first <= sh_first) {
if (sh_return == 0 || cell->first <= sh_first) {
sh_return = cell;
sh_first = cell->first;
}
break;
case shs_fs:
if (sh_return == 0 or cell->length < sh_size or
if (sh_return == 0 || cell->length < sh_size ||
(cell->length == sh_size && cell->first <= sh_first)) {
sh_return = cell;
sh_first = cell->first;
sh_size = cell->length;
}
break;
case shs_fl:
if (sh_return == 0 or cell->length > sh_size or
if (sh_return == 0 || cell->length > sh_size ||
(cell->length == sh_size && cell->first <= sh_first)) {
sh_return = cell;
sh_first = cell->first;
sh_size = cell->length;
}
break;
case shs_fm:
if (sh_return == 0 or nuconn > sh_nuconn or
if (sh_return == 0 || nuconn > sh_nuconn ||
(nuconn == sh_nuconn && cell->first <= sh_first)) {
sh_return = cell;
sh_first = cell->first;
sh_nuconn = nuconn;
}
break;
case shs_fsm:
if (sh_return == 0 or nuconn > sh_nuconn or
(nuconn == sh_nuconn and
(cell->length < sh_size or
if (sh_return == 0 || nuconn > sh_nuconn ||
(nuconn == sh_nuconn &&
(cell->length < sh_size ||
(cell->length == sh_size && cell->first <= sh_first)))) {
sh_return = cell;
sh_first = cell->first;
Expand All @@ -4867,9 +4867,9 @@ bool Graph::nucr_find_first_component(const unsigned int level,
}
break;
case shs_flm:
if (sh_return == 0 or nuconn > sh_nuconn or
(nuconn == sh_nuconn and
(cell->length > sh_size or
if (sh_return == 0 || nuconn > sh_nuconn ||
(nuconn == sh_nuconn &&
(cell->length > sh_size ||
(cell->length == sh_size && cell->first <= sh_first)))) {
sh_return = cell;
sh_first = cell->first;
Expand Down

0 comments on commit 866025c

Please sign in to comment.