diff options
-rw-r--r-- | driver_tsip.c | 9 | ||||
-rw-r--r-- | driver_zodiac.c | 10 | ||||
-rw-r--r-- | gps.h | 4 |
3 files changed, 6 insertions, 17 deletions
diff --git a/driver_tsip.c b/driver_tsip.c index 55010584..0add16ba 100644 --- a/driver_tsip.c +++ b/driver_tsip.c @@ -13,13 +13,6 @@ * SPDX-License-Identifier: BSD-2-clause */ -#ifdef __linux__ -/* FreeBSD chokes on this */ -/* if we insist on C99, then we need this to get M_LN2 from math.h */ -/* 500 mean X/Open 1995 */ -#define _XOPEN_SOURCE 500 -#endif /* __linux__ */ - #if !defined(_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 200112L /* round() needs _POSIX_C_SOURCE >= 200112L */ #define _POSIX_C_SOURCE 200112L @@ -1186,7 +1179,7 @@ static bool tsip_speed_switch(struct gps_device_t *session, } putbyte(buf, 0, 0xff); /* current port */ - putbyte(buf, 1, (round(log((double)speed / 300) / M_LN2)) + 2); /* input dev.baudrate */ + putbyte(buf, 1, (round(log((double)speed / 300) / GPS_LN2)) + 2); /* input dev.baudrate */ putbyte(buf, 2, getub(buf, 1)); /* output baudrate */ putbyte(buf, 3, 3); /* character width (8 bits) */ putbyte(buf, 4, parity); /* parity (normally odd) */ diff --git a/driver_zodiac.c b/driver_zodiac.c index b4c38b01..41a5565a 100644 --- a/driver_zodiac.c +++ b/driver_zodiac.c @@ -10,14 +10,6 @@ * SPDX-License-Identifier: BSD-2-clause */ -#ifdef __linux__ -/* FreeBSD chokes on this */ -/* if we insist on C99, then we need this to get M_LN2 from math.h */ -/* if we insisnt on C99, then we need this to get M_LN2 from math.h */ -/* 500 means X/Open 1995 */ -#define _XOPEN_SOURCE 500 -#endif /* __linux__ */ - #if !defined(_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 200112L /* round() needs _POSIX_C_SOURCE >= 200112L */ #define _POSIX_C_SOURCE 200112L @@ -447,7 +439,7 @@ static bool zodiac_speed_switch(struct gps_device_t *session, data[2] = (unsigned short)parity; /* port 1 character width (8 bits) */ data[3] = (unsigned short)(stopbits - 1); /* port 1 stop bits (1 stopbit) */ data[4] = 0; /* port 1 parity (none) */ - data[5] = (unsigned short)(round(log((double)speed / 300) / M_LN2) + 1); /* port 1 speed */ + data[5] = (unsigned short)(round(log((double)speed / 300) / GPS_LN2) + 1); /* port 1 speed */ data[14] = zodiac_checksum(data, 14); (void)zodiac_spew(session, 1330, data, 15); @@ -2240,6 +2240,10 @@ extern double wgs84_separation(double, double); #define RAD_2_DEG 57.2957795130823208767981548141051703 #define DEG_2_RAD 0.0174532925199432957692369076848861271 +/* other mathematical constants */ +#define GPS_LN2 0.693147180559945309417232121458176568 + + /* geodetic constants */ #define WGS84A 6378137 /* equatorial radius */ #define WGS84F 298.257223563 /* flattening */ |