🐛
This commit is contained in:
@ -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