Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 15 additions & 10 deletions include/warthog/domain/grid.h
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,9 @@ dir_cw90(direction d) noexcept
| ((uint64_t)(SOUTHEAST) << (NORTHEAST_ID << 3))
| ((uint64_t)(SOUTHWEST) << (SOUTHEAST_ID << 3))
| ((uint64_t)(NORTHWEST) << (SOUTHWEST_ID << 3));
int index = std::countr_zero(static_cast<uint16_t>(
d | 256u)); // |256u to ensure no branch in compiler
int index = std::countr_zero(
static_cast<uint16_t>(
d | 256u)); // |256u to ensure no branch in compiler
return static_cast<direction>(sel >> index * 8);
}

Expand Down Expand Up @@ -279,8 +280,9 @@ dir_cw45(direction d) noexcept
| ((uint64_t)(SOUTHEAST) << (EAST_ID << 3))
| ((uint64_t)(SOUTHWEST) << (SOUTH_ID << 3))
| ((uint64_t)(NORTHWEST) << (WEST_ID << 3));
int index = std::countr_zero(static_cast<uint16_t>(
d | 256u)); // |256u to ensure no branch in compiler
int index = std::countr_zero(
static_cast<uint16_t>(
d | 256u)); // |256u to ensure no branch in compiler
return static_cast<direction>(sel >> index * 8);
}

Expand Down Expand Up @@ -312,8 +314,9 @@ dir_ccw90(direction d) noexcept
| ((uint64_t)(SOUTHEAST) << (SOUTHWEST_ID << 3))
| ((uint64_t)(SOUTHWEST) << (NORTHWEST_ID << 3))
| ((uint64_t)(NORTHWEST) << (NORTHEAST_ID << 3));
int index = std::countr_zero(static_cast<uint16_t>(
d | 256u)); // |256u to ensure no branch in compiler
int index = std::countr_zero(
static_cast<uint16_t>(
d | 256u)); // |256u to ensure no branch in compiler
return static_cast<direction>(sel >> index * 8);
}

Expand Down Expand Up @@ -345,8 +348,9 @@ dir_ccw45(direction d) noexcept
| ((uint64_t)(SOUTHEAST) << (SOUTH_ID << 3))
| ((uint64_t)(SOUTHWEST) << (WEST_ID << 3))
| ((uint64_t)(NORTHWEST) << (NORTH_ID << 3));
int index = std::countr_zero(static_cast<uint16_t>(
d | 256u)); // |256u to ensure no branch in compiler
int index = std::countr_zero(
static_cast<uint16_t>(
d | 256u)); // |256u to ensure no branch in compiler
return static_cast<direction>(sel >> index * 8);
}

Expand Down Expand Up @@ -378,8 +382,9 @@ dir_flip(direction d) noexcept
| ((uint64_t)(SOUTHEAST) << (NORTHWEST_ID << 3))
| ((uint64_t)(SOUTHWEST) << (NORTHEAST_ID << 3))
| ((uint64_t)(NORTHWEST) << (SOUTHEAST_ID << 3));
int index = std::countr_zero(static_cast<uint16_t>(
d | 256u)); // |256u to ensure no branch in compiler
int index = std::countr_zero(
static_cast<uint16_t>(
d | 256u)); // |256u to ensure no branch in compiler
return static_cast<direction>(sel >> index * 8);
}

Expand Down
2 changes: 1 addition & 1 deletion include/warthog/util/pqueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ class pqueue
throw std::logic_error("newsize < queuesize_");
}

search::search_node** tmp = new search::search_node* [newsize] {};
search::search_node** tmp = new search::search_node* [newsize] { };
for(unsigned int i = 0; i < queuesize_; i++)
{
tmp[i] = elts_[i];
Expand Down
10 changes: 6 additions & 4 deletions src/scenario/grid_patch_set.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,9 @@ grid_patch_set::load(io::bittable_serialize& S, int max_grids, uint32_t flags)
// header not read
if((flags & SKIP_HEADER) != 0)
{
WARTHOG_GWARN("grid patch SKIP_HEADER for serializer when header "
"has not been read.");
WARTHOG_GWARN(
"grid patch SKIP_HEADER for serializer when header "
"has not been read.");
return -1;
}
if(auto r = S.read_header(); !r)
Expand All @@ -70,8 +71,9 @@ grid_patch_set::load(io::bittable_serialize& S, int max_grids, uint32_t flags)
// header has been read, check
if((flags & FORCE_HEADER) != 0)
{
WARTHOG_GWARN("grid patch FORCE_HEADER for serializer when header "
"has already been read.");
WARTHOG_GWARN(
"grid patch FORCE_HEADER for serializer when header "
"has already been read.");
return -1;
}
}
Expand Down
27 changes: 17 additions & 10 deletions src/scenario/scenario_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,10 @@ scenario_manager::load_gppc_scenario_body_v1(io::scenario_serialize& si)
(uint32_t)Q.goal_y, si.get_map_width(), si.get_map_height(),
cost_value, map_string);
experiments_.push_back(ex);
commands_.push_back(scenario_command::make_inst(
Q.bucket, inst_count_++, (uint32_t)(experiments_.size() - 1)));
commands_.push_back(
scenario_command::make_inst(
Q.bucket, inst_count_++,
(uint32_t)(experiments_.size() - 1)));
}
else if(*con == io::scenario_serialize::FINAL) { break; }
else
Expand Down Expand Up @@ -268,8 +270,9 @@ scenario_manager::load_gppc_scenario_body_v2(io::scenario_serialize& si)
if(last_type == -1)
{
// only used if first command is a inst
commands_.push_back(scenario_command::make_snapshot(
Q.bucket, snapshot_count_++));
commands_.push_back(
scenario_command::make_snapshot(
Q.bucket, snapshot_count_++));
}
if(last_type == -1
|| last_type == io::scenario_serialize::CMD_PATCH)
Expand All @@ -289,8 +292,10 @@ scenario_manager::load_gppc_scenario_body_v2(io::scenario_serialize& si)
Q.start_x, Q.start_y, Q.goal_x, Q.goal_y, si.get_map_width(),
si.get_map_height(), ex_cost, map_string);
experiments_.push_back(ex);
commands_.push_back(scenario_command::make_inst(
Q.bucket, inst_count_++, (uint32_t)(experiments_.size() - 1)));
commands_.push_back(
scenario_command::make_inst(
Q.bucket, inst_count_++,
(uint32_t)(experiments_.size() - 1)));
}
else if(*con == io::scenario_serialize::CMD_PATCH)
{
Expand All @@ -305,14 +310,16 @@ scenario_manager::load_gppc_scenario_body_v2(io::scenario_serialize& si)
if(last_type != io::scenario_serialize::CMD_PATCH
|| last_bucket != P.bucket)
{
commands_.push_back(scenario_command::make_snapshot(
P.bucket, snapshot_count_++));
commands_.push_back(
scenario_command::make_snapshot(
P.bucket, snapshot_count_++));
}
last_type = io::scenario_serialize::CMD_PATCH;
last_bucket = P.bucket;

commands_.push_back(scenario_command::make_patch(
P.bucket, P.patch_id, P.loc_x, P.loc_y));
commands_.push_back(
scenario_command::make_patch(
P.bucket, P.patch_id, P.loc_x, P.loc_y));
}
else if(*con == io::scenario_serialize::FINAL) { break; }
else
Expand Down
10 changes: 6 additions & 4 deletions src/scenario/scenario_runner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@ scenario_runner::experiment_next(uint32_t count, bool progress)
default:
// should never be reached
++command_at_;
WARTHOG_GDEBUG("scenario_runner::experiment_next invalid command "
"type in " WARTHOG_FILENAME_LINE);
WARTHOG_GDEBUG(
"scenario_runner::experiment_next invalid command "
"type in " WARTHOG_FILENAME_LINE);
}
// exits loop
}
Expand Down Expand Up @@ -101,8 +102,9 @@ scenario_runner::snapshot_next(bool clear_patch)
// snapshot_patches increments snapshot_at_
break;
default:
WARTHOG_GDEBUG("scenario_runner::snapshot_next invalid command "
"type in " WARTHOG_FILENAME_LINE);
WARTHOG_GDEBUG(
"scenario_runner::snapshot_next invalid command "
"type in " WARTHOG_FILENAME_LINE);
}
}
return false;
Expand Down