diff --git a/CHANGELOG.md b/CHANGELOG.md index 9448d5ec97f..af4b306dc1c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,7 +21,9 @@ - CHANGED: Upgrade Cucumber-js to v12 [#7221](https://github.com/Project-OSRM/osrm-backend/pull/7221) - CHANGED: Add libcap-setcap to alpine dockerfile [#7241](https://github.com/Project-OSRM/osrm-backend/issues/7241) - FIXED: Minor misspellings found in source code, comments and documents [#7215](https://github.com/Project-OSRM/osrm-backend/pull/7215) + - Profile: - FIXED: Use `cycleway:both` if available. [#6179](https://github.com/Project-OSRM/osrm-backend/issues/6179) + - FIXED: Correctly limit exclude classes to 7. [#7322](https://github.com/Project-OSRM/osrm-backend/pull/7322) # 6.0.0 - Changes from 6.0.0 RC2: None diff --git a/include/extractor/class_data.hpp b/include/extractor/class_data.hpp index 83aa9669fcb..0913148984b 100644 --- a/include/extractor/class_data.hpp +++ b/include/extractor/class_data.hpp @@ -13,9 +13,11 @@ namespace osrm::extractor { using ClassData = std::uint8_t; -constexpr ClassData INAVLID_CLASS_DATA = std::numeric_limits::max(); -static const std::uint8_t MAX_CLASS_INDEX = 8 - 1; -static const std::uint8_t MAX_EXCLUDABLE_CLASSES = 8; +constexpr ClassData INVALID_CLASS_DATA = std::numeric_limits::max(); +static const std::uint8_t MAX_CLASS_INDEX = 7 - 1; +// We can allow for 7 classes, so 0b0111_1111 when all would be set on an edge. +// Setting the MSB would mark it invalid. +static const std::uint8_t MAX_EXCLUDABLE_CLASSES = 7; inline bool isSubset(const ClassData lhs, const ClassData rhs) { return (lhs & rhs) == lhs; } diff --git a/include/extractor/profile_properties.hpp b/include/extractor/profile_properties.hpp index 371155b17fc..c848b6be7ad 100644 --- a/include/extractor/profile_properties.hpp +++ b/include/extractor/profile_properties.hpp @@ -30,7 +30,7 @@ struct ProfileProperties weight_name{"duration"}, class_names{{}}, excludable_classes{{}}, call_tagless_node_function(true) { - std::fill(excludable_classes.begin(), excludable_classes.end(), INAVLID_CLASS_DATA); + std::fill(excludable_classes.begin(), excludable_classes.end(), INVALID_CLASS_DATA); BOOST_ASSERT(weight_name[MAX_WEIGHT_NAME_LENGTH] == '\0'); } diff --git a/include/util/exclude_flag.hpp b/include/util/exclude_flag.hpp index 9a61d169cf4..9913f7ae474 100644 --- a/include/util/exclude_flag.hpp +++ b/include/util/exclude_flag.hpp @@ -15,7 +15,7 @@ excludeFlagsToNodeFilter(const NodeID number_of_nodes, std::vector> filters; for (auto mask : properties.excludable_classes) { - if (mask != extractor::INAVLID_CLASS_DATA) + if (mask != extractor::INVALID_CLASS_DATA) { std::vector allowed_nodes(number_of_nodes); for (const auto node : util::irange(0, number_of_nodes)) diff --git a/unit_tests/extractor/intersection_analysis_tests.cpp b/unit_tests/extractor/intersection_analysis_tests.cpp index 79b261ac74c..7f82695dc40 100644 --- a/unit_tests/extractor/intersection_analysis_tests.cpp +++ b/unit_tests/extractor/intersection_analysis_tests.cpp @@ -19,8 +19,8 @@ using Graph = util::NodeBasedDynamicGraph; BOOST_AUTO_TEST_CASE(simple_intersection_connectivity) { std::vector annotations{ - {EMPTY_NAMEID, 0, INAVLID_CLASS_DATA, TRAVEL_MODE_DRIVING, false}, - {EMPTY_NAMEID, 1, INAVLID_CLASS_DATA, TRAVEL_MODE_DRIVING, false}}; + {EMPTY_NAMEID, 0, INVALID_CLASS_DATA, TRAVEL_MODE_DRIVING, false}, + {EMPTY_NAMEID, 1, INVALID_CLASS_DATA, TRAVEL_MODE_DRIVING, false}}; std::vector restrictions{TurnRestriction{{ViaNodePath{0, 2, 1}}, false}}; CompressedEdgeContainer container; test::MockScriptingEnvironment scripting_environment;