File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -63,14 +63,22 @@ struct t_compressed_block_grid {
63
63
auto itr_x = std::upper_bound (compressed_to_grid_x[layer_num].begin (), compressed_to_grid_x[layer_num].end (), grid_loc.x );
64
64
if (itr_x == compressed_to_grid_x[layer_num].begin ())
65
65
cx = 0 ;
66
- else
66
+ else if (*(itr_x - 1 ) == grid_loc. x )
67
67
cx = std::distance (compressed_to_grid_x[layer_num].begin (), itr_x - 1 );
68
+ else if (itr_x == compressed_to_grid_x[layer_num].end ())
69
+ cx = compressed_to_grid_x[layer_num].size ();
70
+ else
71
+ cx = std::distance (compressed_to_grid_x[layer_num].begin (), itr_x);
68
72
69
73
auto itr_y = std::upper_bound (compressed_to_grid_y[layer_num].begin (), compressed_to_grid_y[layer_num].end (), grid_loc.y );
70
74
if (itr_y == compressed_to_grid_y[layer_num].begin ())
71
75
cy = 0 ;
72
- else
76
+ else if (*(itr_y - 1 ) == grid_loc. y )
73
77
cy = std::distance (compressed_to_grid_y[layer_num].begin (), itr_y - 1 );
78
+ else if (itr_y == compressed_to_grid_y[layer_num].end ())
79
+ cy = compressed_to_grid_y[layer_num].size ();
80
+ else
81
+ cy = std::distance (compressed_to_grid_y[layer_num].begin (), itr_y);
74
82
75
83
return {cx, cy, layer_num};
76
84
}
You can’t perform that action at this time.
0 commit comments