diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2005-06-09 14:17:27 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2005-06-09 14:17:27 +0000 |
commit | 0c79375925aa2f0457d5826f6ecada3cf02953f8 (patch) | |
tree | b61061baabad33f49b722e2e6d2eb23945259f1d /bits.c | |
parent | 31c86f6986feb0d148d972ebeb81ad1f36622320 (diff) | |
download | gpsd-0c79375925aa2f0457d5826f6ecada3cf02953f8.tar.gz |
Second stage of bits.h integration; make the buffer argument explicit.
Diffstat (limited to 'bits.c')
-rw-r--r-- | bits.c | 59 |
1 files changed, 29 insertions, 30 deletions
@@ -5,8 +5,7 @@ #include <string.h> #include "bits.h" -int main (int argc, char *argv[]) - +int main(void) { unsigned char buf[80]; union int_float i_f; @@ -27,51 +26,51 @@ int main (int argc, char *argv[]) memcpy(buf+16,"\x40\x09\x21\xfb\x54\x44\x2d\x18",8); memcpy(buf+24,"\x40\x49\x0f\xdb",4); - sb1 = getsb(0); - sb2 = getsb(8); - ub1 = getub(0); - ub2 = getub(8); - sw1 = getsw(0); - sw2 = getsw(8); - uw1 = getuw(0); - uw2 = getuw(8); - sl1 = getsl(0); - sl2 = getsl(8); - ul1 = getul(0); - ul2 = getul(8); - sL1 = getsL(0); - sL2 = getsL(8); - uL1 = getuL(0); - uL2 = getuL(8); - f1 = getf(24); - d1 = getd(16); + sb1 = getsb(buf, 0); + sb2 = getsb(buf, 8); + ub1 = getub(buf, 0); + ub2 = getub(buf, 8); + sw1 = getsw(buf, 0); + sw2 = getsw(buf, 8); + uw1 = getuw(buf, 0); + uw2 = getuw(buf, 8); + sl1 = getsl(buf, 0); + sl2 = getsl(buf, 8); + ul1 = getul(buf, 0); + ul2 = getul(buf, 8); + sL1 = getsL(buf, 0); + sL2 = getsL(buf, 8); + uL1 = getuL(buf, 0); + uL2 = getuL(buf, 8); + f1 = getf(buf, 24); + d1 = getd(buf, 16); printf("getsb: %016llx %016llx %016llx %016llx\n", (unsigned long long)sb1, (unsigned long long)sb2, - (unsigned long long)getsb(0), (unsigned long long)getsb(8)); + (unsigned long long)getsb(buf, 0), (unsigned long long)getsb(buf, 8)); printf("getub: %016llx %016llx %016llx %016llx\n", (unsigned long long)ub1, (unsigned long long)ub2, - (unsigned long long)getub(0), (unsigned long long)getub(8)); + (unsigned long long)getub(buf, 0), (unsigned long long)getub(buf, 8)); printf("getsw: %016llx %016llx %016llx %016llx\n", (unsigned long long)sw1, (unsigned long long)sw2, - (unsigned long long)getsw(0), (unsigned long long)getsw(8)); + (unsigned long long)getsw(buf, 0), (unsigned long long)getsw(buf, 8)); printf("getuw: %016llx %016llx %016llx %016llx\n", (unsigned long long)uw1, (unsigned long long)uw2, - (unsigned long long)getuw(0), (unsigned long long)getuw(8)); + (unsigned long long)getuw(buf, 0), (unsigned long long)getuw(buf, 8)); printf("getsl: %016llx %016llx %016llx %016llx\n", (unsigned long long)sl1, (unsigned long long)sl2, - (unsigned long long)getsl(0), (unsigned long long)getsl(8)); + (unsigned long long)getsl(buf, 0), (unsigned long long)getsl(buf, 8)); printf("getul: %016llx %016llx %016llx %016llx\n", (unsigned long long)ul1, (unsigned long long)ul2, - (unsigned long long)getul(0), (unsigned long long)getul(8)); + (unsigned long long)getul(buf, 0), (unsigned long long)getul(buf, 8)); printf("getsL: %016llx %016llx %016llx %016llx\n", (unsigned long long)sL1, (unsigned long long)sL2, - (unsigned long long)getsL(0), (unsigned long long)getsL(8)); + (unsigned long long)getsL(buf, 0), (unsigned long long)getsL(buf, 8)); printf("getuL: %016llx %016llx %016llx %016llx\n", (unsigned long long)uL1, (unsigned long long)uL2, - (unsigned long long)getuL(0), (unsigned long long)getuL(8)); - printf("getf: %f %f\n", f1, getf(24)); - printf("getd: %.16f %.16f\n", d1, getd(16)); + (unsigned long long)getuL(buf, 0), (unsigned long long)getuL(buf, 8)); + printf("getf: %f %f\n", f1, getf(buf, 24)); + printf("getd: %.16f %.16f\n", d1, getd(buf, 16)); exit(0); } |