summaryrefslogtreecommitdiff
path: root/test_bits.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2012-06-02 02:08:34 -0400
committerEric S. Raymond <esr@thyrsus.com>2012-06-02 02:08:34 -0400
commitfa034144b0f61a8993a7a48af41334dd9e65d89b (patch)
tree13f79d52bbc284e6924dd97d84bf0ad224606d98 /test_bits.c
parent7b6292a4fed8434b3344821bc7ee0ba1c90e124f (diff)
downloadgpsd-fa034144b0f61a8993a7a48af41334dd9e65d89b.tar.gz
Refacter the bits.c stuff to eliminate ugly globals...
...and be more explicit about operand sizes. All regressuion tests [ass, code splints clean.
Diffstat (limited to 'test_bits.c')
-rw-r--r--test_bits.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/test_bits.c b/test_bits.c
index 0a99d739..5e371ba1 100644
--- a/test_bits.c
+++ b/test_bits.c
@@ -14,8 +14,6 @@
/*@ -duplicatequals -formattype */
static unsigned char buf[80];
-static union int_float i_f;
-static union long_double l_d;
static char sb1, sb2;
static unsigned char ub1, ub2;
static short sw1, sw2;
@@ -70,8 +68,8 @@ static void bedumpall(void)
(void)printf("getbeu64: %016" PRIx64 " %016" PRIx64 " %016" PRIx64 " %016" PRIx64 "\n",
(uint64_t) uL1, (uint64_t) uL2,
(uint64_t) getbeu64(buf, 0), (uint64_t) getbeu64(buf, 8));
- (void)printf("getbef: %f %f\n", f1, getbef(buf, 24));
- (void)printf("getbed: %.16f %.16f\n", d1, getbed(buf, 16));
+ (void)printf("getbef32: %f %f\n", f1, getbef32(buf, 24));
+ (void)printf("getbed64: %.16f %.16f\n", d1, getbed64(buf, 16));
}
static void ledumpall(void)
@@ -100,8 +98,8 @@ static void ledumpall(void)
(void)printf("getleu64: %016" PRIx64 " %016" PRIx64 " %016" PRIx64 " %016" PRIx64 "\n",
(uint64_t) uL1, (uint64_t) uL2,
(uint64_t) getleu64(buf, 0), (uint64_t) getleu64(buf, 8));
- (void)printf("getlef: %f %f\n", f1, getlef(buf, 24));
- (void)printf("getled: %.16f %.16f\n", d1, getled(buf, 16));
+ (void)printf("getlef32: %f %f\n", f1, getlef32(buf, 24));
+ (void)printf("getled64: %.16f %.16f\n", d1, getled64(buf, 16));
}
struct unsigned_test
@@ -170,8 +168,8 @@ int main(int argc, char *argv[])
sL2 = getbes64(buf, 8);
uL1 = getbeu64(buf, 0);
uL2 = getbeu64(buf, 8);
- f1 = getbef(buf, 24);
- d1 = getbed(buf, 16);
+ f1 = getbef32(buf, 24);
+ d1 = getbed64(buf, 16);
/*@+type@*/
bedumpall();
@@ -194,8 +192,8 @@ int main(int argc, char *argv[])
sL2 = getles64(buf, 8);
uL1 = getleu64(buf, 0);
uL2 = getleu64(buf, 8);
- f1 = getlef(buf, 24);
- d1 = getled(buf, 16);
+ f1 = getlef32(buf, 24);
+ d1 = getled64(buf, 16);
/*@+type@*/
ledumpall();
}