diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2013-11-02 18:56:18 -0400 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2013-11-02 18:56:18 -0400 |
commit | 77f21264ad86da9524f938bdf8de56f0dfdd87d0 (patch) | |
tree | 328a4ec7b5f99239c255047a615a0d1dbd1a674a /driver_rtcm2.c | |
parent | 43ec750b7594dc62f815185763a9f0b4e68f44df (diff) | |
download | gpsd-77f21264ad86da9524f938bdf8de56f0dfdd87d0.tar.gz |
Exile a grotty endianness check to the only pace it's used.
Diffstat (limited to 'driver_rtcm2.c')
-rw-r--r-- | driver_rtcm2.c | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/driver_rtcm2.c b/driver_rtcm2.c index c41ed2a7..5c8532e1 100644 --- a/driver_rtcm2.c +++ b/driver_rtcm2.c @@ -62,6 +62,33 @@ BSD terms apply: see the file COPYING in the distribution root for details. #include "gpsd.h" /* + __BIG_ENDIAN__ and __LITTLE_ENDIAN__ are define in some gcc versions + only, probably depending on the architecture. Try to use endian.h if + the gcc way fails - endian.h also doesn not seem to be available on all + platforms. +*/ +#ifdef __BIG_ENDIAN__ +#define WORDS_BIGENDIAN 1 +#else /* __BIG_ENDIAN__ */ +#ifdef __LITTLE_ENDIAN__ +#undef WORDS_BIGENDIAN +#else +#ifdef BSD +#include <sys/endian.h> +#else +#include <endian.h> +#endif +#if __BYTE_ORDER == __BIG_ENDIAN +#define WORDS_BIGENDIAN 1 +#elif __BYTE_ORDER == __LITTLE_ENDIAN +#undef WORDS_BIGENDIAN +#else +#error "unable to determine endianess!" +#endif /* __BYTE_ORDER */ +#endif /* __LITTLE_ENDIAN__ */ +#endif /* __BIG_ENDIAN__ */ + +/* * Structures for interpreting words in an RTCM-104 2.x message (after * parity checking and removing inversion). Note, these structures * are overlayed on the raw data in order to decode them into @@ -76,8 +103,9 @@ BSD terms apply: see the file COPYING in the distribution root for details. * Very few of these are left in 2012. By test, we know of s390, s390x, * and sparc.) * - * The RTCM 2.1 standard is less explicit than it should be about signed-integer - * representations. Two's complement is specified for some but not all. + * The RTCM 2.1 standard is less explicit than it should be about + * signed-integer representations. Two's complement is specified for + * some but not all. */ #define ZCOUNT_SCALE 0.6 /* sec */ |