From: Harlan Stenn Date: Fri, 26 Jun 2015 20:10:51 +0000 (+0000) Subject: smeartest.c fixes from Harlan X-Git-Tag: NTP_4_2_8P3_RC3~11 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=15f01199f0d0ce286e74bd7c9da90b7fdb75d704;p=thirdparty%2Fntp.git smeartest.c fixes from Harlan bk: 558db1cbOk-1BX7sjm1oIkS2Ih4nug --- diff --git a/tests/sandbox/smeartest.c b/tests/sandbox/smeartest.c index d2aab9d97..e1b04e5e3 100644 --- a/tests/sandbox/smeartest.c +++ b/tests/sandbox/smeartest.c @@ -71,7 +71,7 @@ convertLFPToRefID(l_fp num) printf("%03d %08x: ", (temp >> 24) & 0xFF, (temp & 0x00FFFFFF) ); - return temp; + return htonl(temp); } /* Tests start here */ @@ -92,6 +92,39 @@ rtol(uint32_t r) } +void rtoltor(uint32_t r); + +void +rtoltor(uint32_t r) +{ + l_fp l; + + printf("rtoltor: "); + l = convertRefIDToLFP(htonl(r)); + + r = convertLFPToRefID(l); + printf("smear %s, refid %#.8x\n", lfptoa(&l, 8), ntohl(r)); + + return; +} + + +void ltor(l_fp l); + +void +ltor(l_fp l) +{ + uint32_t r; + + printf("ltor: "); + + r = convertLFPToRefID(l); + printf("smear %s, refid %#.8x\n", lfptoa(&l, 8), ntohl(r)); + + return; +} + + main() { @@ -113,5 +146,23 @@ main() rtol(0xfe7ffffe); rtol(0xfe7fffff); + rtoltor(0xfe800000); + rtoltor(0xfe800001); + rtoltor(0xfe8ffffe); + rtoltor(0xfe8fffff); + rtoltor(0xfef00000); + rtoltor(0xfef00001); + rtoltor(0xfefffffe); + rtoltor(0xfeffffff); + + rtoltor(0xfe000000); + rtoltor(0xfe000001); + rtoltor(0xfe6ffffe); + rtoltor(0xfe6fffff); + rtoltor(0xfe700000); + rtoltor(0xfe700001); + rtoltor(0xfe7ffffe); + rtoltor(0xfe7fffff); + return 0; }