diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2013-09-20 16:01:20 -0400 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2013-09-20 16:01:20 -0400 |
commit | 4e6f464178622bcab7cd8b56d43655e2a19b3457 (patch) | |
tree | 7a27d35d27a3fecf42981aa33ab1a21d97f86697 /bits.c | |
parent | 3a8ec0eb97121f8d236e5f3c8b3f3fe16a6e3f14 (diff) | |
download | gpsd-4e6f464178622bcab7cd8b56d43655e2a19b3457.tar.gz |
Add a function to put a big-endian double. Not yet used.
Adapted from a patch by Igor Socec <isocec@gmail.com>.
Diffstat (limited to 'bits.c')
-rw-r--r-- | bits.c | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -127,6 +127,18 @@ void putbef32(char *buf, int off, float val) #ifdef __UNUSED__ // cppcheck-suppress unusedFunction +void putbed64(char *buf, int off, double val) +{ + union long_double l_d; + + l_d.d = val; + /*@-shiftimplementation +ignoresigns@*/ + putbe32(buf, (off), (l_d.l) >> 32); + putbe32(buf, (off)+4, (l_d.l)); + /*@+shiftimplementation -ignoresigns@*/ +} + +// cppcheck-suppress unusedFunction u_int16_t swap_u16(u_int16_t i) /* byte-swap a 16-bit unsigned int */ { |