summaryrefslogtreecommitdiff
path: root/bits.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2013-09-20 16:01:20 -0400
committerEric S. Raymond <esr@thyrsus.com>2013-09-20 16:01:20 -0400
commit4e6f464178622bcab7cd8b56d43655e2a19b3457 (patch)
tree7a27d35d27a3fecf42981aa33ab1a21d97f86697 /bits.c
parent3a8ec0eb97121f8d236e5f3c8b3f3fe16a6e3f14 (diff)
downloadgpsd-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.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/bits.c b/bits.c
index 1914f4f7..88ab2d91 100644
--- a/bits.c
+++ b/bits.c
@@ -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 */
{