diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2010-12-15 03:26:55 -0500 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2010-12-15 03:26:55 -0500 |
commit | 45b89f1cb3deeafe2213cb187fbbd6807928a02b (patch) | |
tree | f2aa238749cc663dcc31e9e7d17184b9ccd51e1f /driver_garmin.c | |
parent | 645bcbe0f2378d55fd06e9e3a2e7996fdc64ebfb (diff) | |
download | gpsd-45b89f1cb3deeafe2213cb187fbbd6807928a02b.tar.gz |
Use our own macros for interpreting little-endian 16- and 32-byte integers.
It's not pretty, but it passes regressions and the compiler's peeophole
optimizer will propbably turn it into tight code.
Diffstat (limited to 'driver_garmin.c')
-rw-r--r-- | driver_garmin.c | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/driver_garmin.c b/driver_garmin.c index 56dfaa3b..fd446778 100644 --- a/driver_garmin.c +++ b/driver_garmin.c @@ -80,36 +80,23 @@ #define __USE_POSIX199309 1 #include <math.h> - #include <string.h> +#include <errno.h> #ifndef S_SPLINT_S #include <unistd.h> #endif /* S_SPLINT_S */ -#include <errno.h> #include "gpsd_config.h" -/* - * gpsd uses non-POSIX le16toh. Attempt to deal with this portably, - * failing obviously on systems that don't have support. - * Systems known to work: Linux, NetBSD - */ - -#if defined(le16toh) -#define GPSD_LE16TOH le16toh -#define GPSD_LE32TOH le32toh -#elif defined(letoh16) -#define GPSD_LE16TOH letoh16 -#define GPSD_LE32TOH letoh32 -#else -#error "don't know how to convert little endian to host order" -#endif - #if defined(HAVE_LIBUSB) #include <libusb.h> #endif #include "gpsd.h" +#include "bits.h" + +#define GPSD_LE16TOH(x) getlesw((char *)(&(x)), 0) +#define GPSD_LE32TOH(x) getlesl((char *)(&(x)), 0) #ifdef GARMIN_ENABLE |