*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
int32_t d = a - b;
if (d < 0)
d = -d;
+
return (uint32_t) ((int64_t) d * 111198 / 10000000);
}
uint32_t lon_dist;
/* check if it's shorter to go the other way around */
- if (lon_a < lon_b - 1800000000)
- lon_a += 3600000000;
+ if ((lon_a >> 1) < (lon_b >> 1) - (1800000000 >> 1))
+ lon_a = (int32_t) ((uint32_t) lon_a + 3600000000UL);
lon_dist = ao_dist(lon_a, lon_b);
if (c) {
if (lon_dist & 0x7f800000)