From 2101a86ef6870b5073df2a8b93ece0d5ce44e451 Mon Sep 17 00:00:00 2001 From: Charles Karney Date: Mon, 15 Feb 2016 20:51:06 -0500 Subject: geodesic.c: move declarations to beginings of functions. --- src/geodesic.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/geodesic.c b/src/geodesic.c index 8d9c9285..e897e89e 100644 --- a/src/geodesic.c +++ b/src/geodesic.c @@ -187,8 +187,9 @@ static real AngDiff(real x, real y, real* e) { static real AngRound(real x) { const real z = 1/(real)(16); + volatile real y; if (x == 0) return 0; - volatile real y = fabs(x); + y = fabs(x); /* The compiler mustn't "simplify" z - (z - y) to y */ y = y < z ? z - (z - y) : y; return x < 0 ? -y : y; @@ -413,8 +414,8 @@ static void geod_lineinit_int(struct geod_geodesicline* l, void geod_lineinit(struct geod_geodesicline* l, const struct geod_geodesic* g, real lat1, real lon1, real azi1, unsigned caps) { - azi1 = AngNormalize(azi1); real salp1, calp1; + azi1 = AngNormalize(azi1); /* Guard against underflow in salp0 */ sincosdx(AngRound(azi1), &salp1, &calp1); geod_lineinit_int(l, g, lat1, lon1, azi1, salp1, calp1, caps); -- cgit v1.2.3