🐛
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@ -8,6 +8,7 @@ A1/coord_query_naive
|
||||
A1/id_query_naive
|
||||
A1/id_query_indexed
|
||||
A1/id_query_binsort
|
||||
A1/random_ids
|
||||
|
||||
*/.vscode/
|
||||
.vscode/
|
@ -16,13 +16,13 @@ double closest_point_distance;
|
||||
|
||||
int lon_comp_func(const void* a, const void* b) {
|
||||
return (
|
||||
((struct record*)a)->lon - ((struct record*)b)->lon
|
||||
((struct record*)a)->lon > ((struct record*)b)->lon
|
||||
);
|
||||
}
|
||||
|
||||
int lat_comp_func(const void* a, const void* b) {
|
||||
return (
|
||||
((struct record*)a)->lat - ((struct record*)b)->lat
|
||||
((struct record*)a)->lat > ((struct record*)b)->lat
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,7 @@ struct indexed_data {
|
||||
|
||||
int comp_func(const void* a, const void* b) {
|
||||
return (
|
||||
((struct index_record*)a)->osm_id - ((struct index_record*)b)->osm_id
|
||||
((struct index_record*)a)->osm_id > ((struct index_record*)b)->osm_id
|
||||
);
|
||||
}
|
||||
|
||||
@ -48,8 +48,9 @@ void free_indexed(struct indexed_data* data) {
|
||||
const struct record* lookup_indexed(struct indexed_data *data, int64_t needle) {
|
||||
int bottom = 0;
|
||||
int top = data->n;
|
||||
int mid;
|
||||
while (top >= bottom) {
|
||||
int mid = bottom + ((top - bottom) / 2);
|
||||
mid = bottom + ((top - bottom) / 2);
|
||||
if ((&data->irs[mid])->osm_id < needle) {
|
||||
bottom = mid + 1;
|
||||
}
|
||||
|
Reference in New Issue
Block a user