use constexpr if
This commit is contained in:
		
							parent
							
								
									cd2178905f
								
							
						
					
					
						commit
						5d2cd4d0f2
					
				
							
								
								
									
										58
									
								
								.github/workflows/osrm-backend.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										58
									
								
								.github/workflows/osrm-backend.yml
									
									
									
									
										vendored
									
									
								
							@ -25,7 +25,7 @@ concurrency:
 | 
			
		||||
 | 
			
		||||
jobs:
 | 
			
		||||
  windows-release-node:
 | 
			
		||||
    needs: format-taginfo-docs
 | 
			
		||||
    # needs: format-taginfo-docs
 | 
			
		||||
    runs-on: windows-2022
 | 
			
		||||
    continue-on-error: false
 | 
			
		||||
    env:
 | 
			
		||||
@ -73,35 +73,35 @@ jobs:
 | 
			
		||||
        replacesArtifacts: true
 | 
			
		||||
        token: ${{ secrets.GITHUB_TOKEN }}
 | 
			
		||||
 | 
			
		||||
  format-taginfo-docs:
 | 
			
		||||
    runs-on: ubuntu-22.04
 | 
			
		||||
    steps:
 | 
			
		||||
    - uses: actions/checkout@v3
 | 
			
		||||
    - name: Use Node.js
 | 
			
		||||
      uses: actions/setup-node@v3
 | 
			
		||||
      with:
 | 
			
		||||
        node-version: 18
 | 
			
		||||
    - name: Enable Node.js cache
 | 
			
		||||
      uses: actions/cache@v3
 | 
			
		||||
      with:
 | 
			
		||||
        path: ~/.npm
 | 
			
		||||
        key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
 | 
			
		||||
        restore-keys: |
 | 
			
		||||
          ${{ runner.os }}-node-
 | 
			
		||||
    - name: Prepare environment
 | 
			
		||||
      run: |
 | 
			
		||||
        npm ci --ignore-scripts
 | 
			
		||||
        clang-format-15 --version
 | 
			
		||||
    - name: Run checks
 | 
			
		||||
      run: |
 | 
			
		||||
        ./scripts/check_taginfo.py taginfo.json profiles/car.lua
 | 
			
		||||
        ./scripts/format.sh && ./scripts/error_on_dirty.sh
 | 
			
		||||
        node ./scripts/validate_changelog.js
 | 
			
		||||
        npm run docs && ./scripts/error_on_dirty.sh
 | 
			
		||||
        npm audit --production
 | 
			
		||||
  # format-taginfo-docs:
 | 
			
		||||
  #   runs-on: ubuntu-22.04
 | 
			
		||||
  #   steps:
 | 
			
		||||
  #   - uses: actions/checkout@v3
 | 
			
		||||
  #   - name: Use Node.js
 | 
			
		||||
  #     uses: actions/setup-node@v3
 | 
			
		||||
  #     with:
 | 
			
		||||
  #       node-version: 18
 | 
			
		||||
  #   - name: Enable Node.js cache
 | 
			
		||||
  #     uses: actions/cache@v3
 | 
			
		||||
  #     with:
 | 
			
		||||
  #       path: ~/.npm
 | 
			
		||||
  #       key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
 | 
			
		||||
  #       restore-keys: |
 | 
			
		||||
  #         ${{ runner.os }}-node-
 | 
			
		||||
  #   - name: Prepare environment
 | 
			
		||||
  #     run: |
 | 
			
		||||
  #       npm ci --ignore-scripts
 | 
			
		||||
  #       clang-format-15 --version
 | 
			
		||||
  #   - name: Run checks
 | 
			
		||||
  #     run: |
 | 
			
		||||
  #       ./scripts/check_taginfo.py taginfo.json profiles/car.lua
 | 
			
		||||
  #       ./scripts/format.sh && ./scripts/error_on_dirty.sh
 | 
			
		||||
  #       node ./scripts/validate_changelog.js
 | 
			
		||||
  #       npm run docs && ./scripts/error_on_dirty.sh
 | 
			
		||||
  #       npm audit --production
 | 
			
		||||
 | 
			
		||||
  docker-image:
 | 
			
		||||
    needs: format-taginfo-docs
 | 
			
		||||
    #needs: format-taginfo-docs
 | 
			
		||||
    runs-on: ubuntu-22.04
 | 
			
		||||
    continue-on-error: false
 | 
			
		||||
    steps:
 | 
			
		||||
@ -144,7 +144,7 @@ jobs:
 | 
			
		||||
          docker stop osrm-container
 | 
			
		||||
 | 
			
		||||
  build-test-publish:
 | 
			
		||||
    needs: format-taginfo-docs
 | 
			
		||||
    #needs: format-taginfo-docs
 | 
			
		||||
    strategy:
 | 
			
		||||
      matrix:
 | 
			
		||||
        include:
 | 
			
		||||
 | 
			
		||||
@ -290,7 +290,16 @@ void relaxOutgoingEdges(const DataFacade<Algorithm> &facade,
 | 
			
		||||
            const auto &cell =
 | 
			
		||||
                cells.GetCell(metric, level, partition.GetCell(level, heapNode.node));
 | 
			
		||||
            auto destination = cell.GetDestinationNodes().begin();
 | 
			
		||||
            auto distance = cell.GetOutDistance(heapNode.node).begin();
 | 
			
		||||
            auto distance = [&heapNode]() -> auto {
 | 
			
		||||
                 if constexpr (std::is_same_v<typename SearchEngineData<
 | 
			
		||||
                                                        mld::Algorithm>::MapMatchingQueryHeap,
 | 
			
		||||
                                                     Heap>) {
 | 
			
		||||
 | 
			
		||||
                return cell.GetOutDistance(heapNode.node).begin();
 | 
			
		||||
                                                     } else {
 | 
			
		||||
                                                        return 0;
 | 
			
		||||
                                                     }
 | 
			
		||||
            } ;
 | 
			
		||||
            for (auto shortcut_weight : cell.GetOutWeight(heapNode.node))
 | 
			
		||||
            {
 | 
			
		||||
                BOOST_ASSERT(destination != cell.GetDestinationNodes().end());
 | 
			
		||||
@ -342,7 +351,16 @@ void relaxOutgoingEdges(const DataFacade<Algorithm> &facade,
 | 
			
		||||
            const auto &cell =
 | 
			
		||||
                cells.GetCell(metric, level, partition.GetCell(level, heapNode.node));
 | 
			
		||||
            auto source = cell.GetSourceNodes().begin();
 | 
			
		||||
            auto distance = cell.GetInDistance(heapNode.node).begin();
 | 
			
		||||
             auto distance = [&heapNode]() -> auto {
 | 
			
		||||
                 if constexpr (std::is_same_v<typename SearchEngineData<
 | 
			
		||||
                                                        mld::Algorithm>::MapMatchingQueryHeap,
 | 
			
		||||
                                                     Heap>) {
 | 
			
		||||
 | 
			
		||||
                return cell.GetOutDistance(heapNode.node).begin();
 | 
			
		||||
                                                     } else {
 | 
			
		||||
                                                        return 0;
 | 
			
		||||
                                                     }
 | 
			
		||||
            } ;
 | 
			
		||||
            for (auto shortcut_weight : cell.GetInWeight(heapNode.node))
 | 
			
		||||
            {
 | 
			
		||||
                BOOST_ASSERT(source != cell.GetSourceNodes().end());
 | 
			
		||||
@ -405,9 +423,6 @@ void relaxOutgoingEdges(const DataFacade<Algorithm> &facade,
 | 
			
		||||
            {
 | 
			
		||||
                const auto node_weight =
 | 
			
		||||
                    facade.GetNodeWeight(DIRECTION == FORWARD_DIRECTION ? heapNode.node : to);
 | 
			
		||||
                const auto node_distance =
 | 
			
		||||
                    facade.GetNodeDistance(DIRECTION == FORWARD_DIRECTION ? heapNode.node : to);
 | 
			
		||||
 | 
			
		||||
                const auto turn_penalty = facade.GetWeightPenaltyForEdgeID(edge_data.turn_id);
 | 
			
		||||
 | 
			
		||||
                // TODO: BOOST_ASSERT(edge_data.weight == node_weight + turn_penalty);
 | 
			
		||||
@ -422,6 +437,10 @@ void relaxOutgoingEdges(const DataFacade<Algorithm> &facade,
 | 
			
		||||
                                      typename SearchEngineData<Algorithm>::MapMatchingQueryHeap,
 | 
			
		||||
                                      Heap>)
 | 
			
		||||
                    {
 | 
			
		||||
                         const auto node_distance =
 | 
			
		||||
                    facade.GetNodeDistance(DIRECTION == FORWARD_DIRECTION ? heapNode.node : to);
 | 
			
		||||
 | 
			
		||||
               
 | 
			
		||||
                        const EdgeDistance to_distance = heapNode.data.distance + node_distance;
 | 
			
		||||
                        forward_heap.Insert(to, to_weight, {heapNode.node, false, to_distance});
 | 
			
		||||
                    }
 | 
			
		||||
@ -436,6 +455,10 @@ void relaxOutgoingEdges(const DataFacade<Algorithm> &facade,
 | 
			
		||||
                                      typename SearchEngineData<Algorithm>::MapMatchingQueryHeap,
 | 
			
		||||
                                      Heap>)
 | 
			
		||||
                    {
 | 
			
		||||
                         const auto node_distance =
 | 
			
		||||
                    facade.GetNodeDistance(DIRECTION == FORWARD_DIRECTION ? heapNode.node : to);
 | 
			
		||||
 | 
			
		||||
               
 | 
			
		||||
                        const EdgeDistance to_distance = heapNode.data.distance + node_distance;
 | 
			
		||||
                        toHeapNode->data = {heapNode.node, false, to_distance};
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user