[Git][NTPsec/ntpsec][greek-mu] 8 commits: l_fp: don't multiply to negate...

Ian Bruene gitlab at mg.gitlab.com
Thu Apr 6 00:58:54 UTC 2017


Ian Bruene pushed to branch greek-mu at NTPsec / ntpsec


Commits:
8b1f971c by Gary E. Miller at 2017-04-05T16:32:34-07:00
l_fp: don't multiply to negate...

All tests pass.

- - - - -
975b1525 by Gary E. Miller at 2017-04-05T16:32:34-07:00
tests/ieee754io: tweak some tests.  Avoid shift wrapping.

- - - - -
986e321a by Gary E. Miller at 2017-04-05T16:32:34-07:00
ieee754io: simplification using uint64_t.

All tests pass.

- - - - -
86e474b2 by Gary E. Miller at 2017-04-05T16:32:34-07:00
waf: Solaris and OpenBSD are not POSIX, using custom types.

Need to fix upstream bug in Bison, and test for Solaris
and OpenBSD weirdness before -Wsign-conversion can be used.

- - - - -
2574c788 by Gary E. Miller at 2017-04-05T16:54:28-07:00
ieee754: clean up indents, tabs and comments.  No functional change.

Passes all tests.

- - - - -
bbdd7c6f by Gary E. Miller at 2017-04-05T17:02:20-07:00
generic: remove unused include and defines.

- - - - -
e5807e2b by Ian Bruene at 2017-04-06T00:16:50+00:00
Fixed cropped display width when displaying units.

Bug mostly effecteed dispersion.

- - - - -
1d27e7ad by Ian Bruene at 2017-04-06T00:57:47+00:00
Changed microsecond unit string to use a proper greek mu.

Mu.

- - - - -


7 changed files:

- include/ntp_fp.h
- libparse/ieee754io.c
- ntpclients/ntpmon
- ntpd/refclock_generic.c
- pylib/util.py
- tests/libparse/ieee754io.c
- wafhelpers/configure.py


Changes:

=====================================
include/ntp_fp.h
=====================================
--- a/include/ntp_fp.h
+++ b/include/ntp_fp.h
@@ -142,7 +142,7 @@ static inline l_fp ntohl_fp(l_fp_w lfpw) {
  * native operations is to be independent of whether the l_fp
  * type is signed or unsigned.
  */
-#define	L_NEG(v)	(v) = (l_fp)(-1 * (int64_t)(v))
+#define	L_NEG(v)	(v) = (l_fp)(-(int64_t)(v))
 #define	L_ISNEG(v)	M_ISNEG(lfpuint(v))
 #define	L_ISGT(a, b)	((int64_t)(a) > (int64_t)(b))
 #define	L_ISGTU(a, b)	((a) > (b))


=====================================
libparse/ieee754io.c
=====================================
--- a/libparse/ieee754io.c
+++ b/libparse/ieee754io.c
@@ -13,7 +13,7 @@
 #include "ntp_fp.h"
 #include "ieee754io.h"
 
-static unsigned long get_byte (unsigned char *, offsets_t, int *);
+static uint64_t get_byte (unsigned char *, offsets_t, int *);
 
 #ifdef DEBUG_PARSELIB
 
@@ -21,90 +21,88 @@ static unsigned long get_byte (unsigned char *, offsets_t, int *);
 
 static char *
 fmt_blong(
-	  unsigned long val,
-	  int cnt
-	  )
+          unsigned long val,
+          int cnt
+          )
 {
-  char *buf, *s;
-  int i = cnt;
-
-  val <<= 32 - cnt;
-  LIB_GETBUF(buf);
-  s = buf;
-  
-  while (i--)
-    {
-      if (val & 0x80000000)
-	{
-	  *s++ = '1';
-	}
-      else
-	{
-	  *s++ = '0';
-	}
-      val <<= 1;
+    char *buf, *s;
+    int i = cnt;
+
+    val <<= 32 - cnt;
+    LIB_GETBUF(buf);
+    s = buf;
+
+    while (i--) {
+        if (val & 0x80000000) {
+            *s++ = '1';
+        } else {
+            *s++ = '0';
+        }
+        val <<= 1;
     }
-  *s = '\0';
-  return buf;
+    *s = '\0';
+    return buf;
 }
 
 static char *
 fmt_flt(
-	bool sign,
-	unsigned long mh,
-	unsigned long ml,
-	unsigned long ch
-	)
+        bool sign,
+        uint64_t ml,
+        unsigned long ch,
+        int length
+        )
 {
-	char *buf;
-
-	LIB_GETBUF(buf);
-	snprintf(buf, LIB_BUFLENGTH, "%c %s %s %s", sign ? '-' : '+',
-		 fmt_blong(ch, 11),
-		 fmt_blong(mh, 20),
-		 fmt_blong(ml, 32));
-
-	return buf;
+        char *buf;
+
+        LIB_GETBUF(buf);
+        if ( 8 == length ) {
+            snprintf(buf, LIB_BUFLENGTH, "%c %s %s %s", sign ? '-' : '+',
+                     fmt_blong(ch, 11),
+                     fmt_blong(ml >> 32, 20),
+                     fmt_blong(ml & 0x0FFFFFFFFULL, 32));
+        } else {
+            snprintf(buf, LIB_BUFLENGTH, "%c %s %s", sign ? '-' : '+',
+                     fmt_blong(ch, 8),
+                     fmt_blong(ml, 23));
+        }
+
+        return buf;
 }
 
 static char *
 fmt_hex(
-	unsigned char *bufp,
-	int length
-	)
+        unsigned char *bufp,
+        int length
+        )
 {
-	char *	buf;
-	char	hex[4];
-	int	i;
-
-	LIB_GETBUF(buf);
-	buf[0] = '\0';
-	for (i = 0; i < length; i++) {
-		snprintf(hex, sizeof(hex), "%02x", bufp[i]);
-		strlcat(buf, hex, LIB_BUFLENGTH);
-	}
-
-	return buf;
+        char *  buf;
+        char    hex[4];
+        int     i;
+
+        LIB_GETBUF(buf);
+        buf[0] = '\0';
+        for (i = 0; i < length; i++) {
+                snprintf(hex, sizeof(hex), "%02x", bufp[i]);
+                strlcat(buf, hex, LIB_BUFLENGTH);
+        }
+
+        return buf;
 }
 
 #endif
 
-static unsigned long
+static uint64_t
 get_byte(
-	 unsigned char *bufp,
-	 offsets_t offset,
-	 int *fieldindex
-	 )
+         unsigned char *bufp,
+         offsets_t offset,
+         int *fieldindex
+         )
 {
-  unsigned char val;
+    unsigned char val;
 
-  val     = *(bufp + offset[*fieldindex]);
-#ifdef DEBUG_PARSELIB
-  if (debug > 4)
-    printf("fetchieee754: getbyte(0x%08x, %d) = 0x%02x\n", (unsigned int)(bufp)+offset[*fieldindex], *fieldindex, val);
-#endif
-  (*fieldindex)++;
-  return val;
+    val = *(bufp + offset[*fieldindex]);
+    (*fieldindex)++;
+    return val;
 }
 
 /*
@@ -113,209 +111,138 @@ get_byte(
  */
 int
 fetch_ieee754(
-	      unsigned char **buffpp,
-	      int size,
-	      l_fp *lfpp,
-	      offsets_t offsets
-	      )
+              unsigned char **buffpp,
+              int size,
+              l_fp *lfpp,
+              offsets_t offsets
+              )
 {
-  unsigned char *bufp = *buffpp;
-  bool sign;
-  unsigned int bias;
-  unsigned int maxexp;
-  int mbits;
-  unsigned long mantissa_low;
-  unsigned long mantissa_high;
-  unsigned long characteristic;    /* biased exponent */
-  long exponent;                   /* unbiased exponent */
-  unsigned int maxexp_lfp;         /* maximum exponent that fits in an l_fp */
-  int frac_offset;	           /* where the fraction starts */
-#ifdef DEBUG_PARSELIB
-  int length;
-#endif
-  unsigned char val;
-  int fieldindex = 0;              /* index into bufp */
-  
+    unsigned char *bufp = *buffpp;
+    bool sign;
+    unsigned int bias;              /* bias 127 or 1023 */
+    unsigned int maxexp;
+    int mbits;                      /* length of mantissa, 23 or 52 */
+    uint64_t mantissa;              /* mantissa, 23 or 52 bits used, +1 */
+    unsigned long characteristic;   /* biased exponent, 0 to 255 or 2047 */
+    int exponent;                   /* unbiased exponent */
+    unsigned int maxexp_lfp;        /* maximum exponent that fits in an l_fp */
+    unsigned char val;
+    int fieldindex = 0;             /* index into bufp */
+    int fudge;                      /* shift difference of l_fp and IEEE */
+    int shift;                      /* amount to shift IEEE to get l_fp */
 
-  *lfpp = 0;           /* return zero for all errors: NAN, +INF, -INF, etc. */
 
-  /* fetch sign byte & first part of characteristic */
-  val = get_byte(bufp, offsets, &fieldindex);
+    *lfpp = 0;          /* return zero for all errors: NAN, +INF, -INF, etc. */
 
-  sign = (val & 0x80) != 0;
-  characteristic = (val & 0x7F);
+    /* fetch sign byte & first part of characteristic */
+    val = get_byte(bufp, offsets, &fieldindex);
 
-  /* fetch rest of characteristic and start of mantissa */
-  val = get_byte(bufp, offsets, &fieldindex);
+    sign = (val & 0x80) != 0;
+    characteristic = (val & 0x7F);
 
-  switch (size)
-    {
+    /* fetch rest of characteristic and start of mantissa */
+    val = get_byte(bufp, offsets, &fieldindex);
+
+    switch (size) {
     case IEEE_DOUBLE:
-#ifdef DEBUG_PARSELIB
-      length = 8;
-#endif
-      maxexp_lfp = 31;
-      mbits  = 52;
-      bias   = 1023;
-      maxexp = 2047;
-      characteristic <<= 4;
-      /* grab lower characteristic bits */
-      characteristic  |= (val & 0xF0U) >> 4;
-
-      mantissa_high  = (val & 0x0FU) << 16;
-      mantissa_high |= get_byte(bufp, offsets, &fieldindex) << 8;
-      mantissa_high |= get_byte(bufp, offsets, &fieldindex);
-
-      mantissa_low   = get_byte(bufp, offsets, &fieldindex) << 24;
-      mantissa_low  |= get_byte(bufp, offsets, &fieldindex) << 16;
-      mantissa_low  |= get_byte(bufp, offsets, &fieldindex) << 8;
-      mantissa_low  |= get_byte(bufp, offsets, &fieldindex);
-      break;
+        fudge = -20;
+        maxexp_lfp = 31;
+        mbits  = 52;
+        bias   = 1023;
+        maxexp = 2047;
+        characteristic <<= 4;
+        /* grab lower characteristic bits */
+        characteristic  |= (val & 0xF0U) >> 4;
+
+        mantissa  = (val & 0x0FULL) << 48;
+        mantissa |= get_byte(bufp, offsets, &fieldindex) << 40;
+        mantissa |= get_byte(bufp, offsets, &fieldindex) << 32;
+
+        mantissa |= get_byte(bufp, offsets, &fieldindex) << 24;
+        mantissa |= get_byte(bufp, offsets, &fieldindex) << 16;
+        mantissa |= get_byte(bufp, offsets, &fieldindex) << 8;
+        mantissa |= get_byte(bufp, offsets, &fieldindex);
+        break;
 
     case IEEE_SINGLE:
+        fudge = 9;
+        maxexp_lfp = 127;
+        mbits  = 23;
+        bias   = 127;
+        maxexp = 255;
+        characteristic <<= 1;
+        /* grab last characteristic bit from 2nd byte */
+        characteristic |= (val & 0x80) ? 1U : 0 ;
+
+        mantissa   = (val & 0x7FU) << 16;
+        mantissa  |= get_byte(bufp, offsets, &fieldindex) << 8;
+        mantissa  |= get_byte(bufp, offsets, &fieldindex);
+        break;
+
+    default:
+        return IEEE_BADCALL;
+    }
+
+      exponent = (int)characteristic - (int)bias;
+
 #ifdef DEBUG_PARSELIB
-      length = 4;
+    if ( debug > 4) {
+        int length = 8;
+        if ( IEEE_SINGLE == size ) {
+            length = 4;
+        }
+
+        printf("\nfetchieee754: FP: %s -> %s\n", fmt_hex(*buffpp, length),
+               fmt_flt(sign, mantissa, characteristic, length));
+        printf("fetchieee754: Exp: %d, mbits %d\n", exponent, mbits);
+    }
 #endif
-      maxexp_lfp = 127;
-      mbits  = 23;
-      bias   = 127;
-      maxexp = 255;
-      characteristic <<= 1;
-      /* grab last characteristic bit from 2nd byte */
-      characteristic |= (val & 0x80) ? 1U : 0 ;
 
-      mantissa_high  = 0;
+    *buffpp += fieldindex;
+
+    /* detect funny numbers */
+    if (characteristic == maxexp) {
+        /* NaN or Infinity */
+        if (mantissa) {
+            /* NaN */
+            return IEEE_NAN;
+        }
+        /* +Inf or -Inf */
+        return sign ? IEEE_NEGINFINITY : IEEE_POSINFINITY;
+    }
 
-      mantissa_low   = (val & 0x7FU) << 16;
-      mantissa_low  |= get_byte(bufp, offsets, &fieldindex) << 8;
-      mantissa_low  |= get_byte(bufp, offsets, &fieldindex);
-      break;
+    /* check for overflows */
+    if (exponent > (int)maxexp_lfp) {
+        /*
+        * sorry an l_fp only so long
+        * overflow only in respect to NTP-FP representation
+        */
+        return sign ? IEEE_NEGOVERFLOW : IEEE_POSOVERFLOW;
+    }
 
-    default:
-      return IEEE_BADCALL;
+    if (characteristic == 0) {
+        /* de-normalized or tiny number - fits only as 0 */
+        return IEEE_OK;
     }
 
-#ifdef DEBUG_PARSELIB
-  if (debug > 4) {
-    double d;
-    float f;
-
-    if (size == IEEE_SINGLE)
-      {
-	int i;
-
-	for (i = 0; i < length; i++)
-	  {
-	    *((unsigned char *)(&f)+i) = *(*buffpp + offsets[i]);
-	  }
-	d = f;
-    } else {
-	int i;
+    /* build the real number */
 
-	for (i = 0; i < length; i++)
-	  {
-	    *((unsigned char *)(&d)+i) = *(*buffpp + offsets[i]);
-	  }
-    }
-    
-    printf("fetchieee754: FP: %s -> %s -> %e(=%s)\n", fmt_hex(*buffpp, length),
-	   fmt_flt(sign, mantissa_high, mantissa_low, characteristic),
-	   d, fmt_hex((unsigned char *)&d, length));
-  }
-#endif
+    /* add in implied 1 */
+    mantissa  |= 1ULL << mbits;
 
-  *buffpp += fieldindex;
-  
-  /*
-   * detect funny numbers
-   */
-  if (characteristic == maxexp) {
-      /*
-       * NaN or Infinity
-       */
-      if (mantissa_low || mantissa_high) {
-	  /*
-	   * NaN
-	   */
-	  return IEEE_NAN;
-      }
-      /*
-       * +Inf or -Inf
-       */
-      return sign ? IEEE_NEGINFINITY : IEEE_POSINFINITY;
-  }
-  /*
-   * collect real numbers
-   */
-
-  /*
-   * check for overflows
-   */
-  exponent = (long int)characteristic - bias;
-
-  if (exponent > maxexp_lfp) {
-      /*
-       * sorry an l_fp only so long
-       * overflow only in respect to NTP-FP representation
-       */
-      return sign ? IEEE_NEGOVERFLOW : IEEE_POSOVERFLOW;
-  }
-
-  frac_offset = mbits - exponent;
-
-  if (characteristic == 0) {
-      /*
-       * de-normalized or tiny number - fits only as 0
-       */
-      return IEEE_OK;
-  }
-
-  /*
-   * adjust for implied 1
-   */
-  if (mbits > 31)
-    mantissa_high |= 1U << (mbits - 32);
-  else
-    mantissa_low  |= 1U << mbits;
-
-  /*
-   * take mantissa apart - if only all machine would support
-   * 64 bit operations 8-(
-   */
-  if (frac_offset > mbits) {
-      frac_offset -= mbits + 1; /* will now contain right shift count - 1*/
-      if (mbits > 31) {
-	  uint32_t frac;
-	  frac   = mantissa_high << (63 - mbits);
-	  frac  |= mantissa_low  >> (mbits - 33);
-	  frac >>= frac_offset;
-	  *lfpp = lfpfrac(frac);
-      } else {
-	  *lfpp = lfpfrac( mantissa_low >> frac_offset);
-      }
-  } else if (frac_offset > 32) {
-	/*
-	 * must split in high word
-	 */
-	*lfpp = lfptouint(mantissa_high >> (frac_offset - 32));
-	*lfpp |= lfpfrac(((mantissa_high &
-                       ((1U << (frac_offset - 32)) - 1)) << (64 - frac_offset)) |
-                        (mantissa_low  >> (frac_offset - 32)));
-  } else {
-	/*
-	 * must split in low word
-	 */
-	*lfpp = lfptouint((mantissa_high << (32 - frac_offset)) |
-                          (((mantissa_low >> frac_offset) &
-                           ((1U << (32 - frac_offset)) - 1))));
-	/* coverity[large_shift] */
-	*lfpp |= lfpfrac((mantissa_low &
-                        ((1U << frac_offset) - 1)) << (32 - frac_offset));
+    shift = exponent + fudge;
+    if ( 0 == shift ) {
+        /* no shift */
+        *lfpp = mantissa;
+    } else if ( 0 > shift ) {
+        /* right shift */
+        *lfpp = mantissa >> -shift;
+    } else {
+        /* left shift */
+        *lfpp = mantissa << shift;
     }
 
-    /*
-     * adjust for sign
-     */
+    /* adjust for sign */
     if (sign) {
       L_NEG(*lfpp);
     }


=====================================
ntpclients/ntpmon
=====================================
--- a/ntpclients/ntpmon
+++ b/ntpclients/ntpmon
@@ -91,13 +91,15 @@ def peer_detail(variables, showunits=False):
                 vcopy[name] = ntp.util.unitformatter(vcopy[name],
                                                      ntp.util.UNITS_SEC,
                                                      ntp.util.UNIT_MS,
-                                                     strip=True)
+                                                     strip=True,
+                                                     width=None)
         for name in ntp.util.PPM_VARS:
             if name in vcopy:
                 vcopy[name] = ntp.util.unitformatter(vcopy[name],
                                                      ntp.util.UNIT_PPM,
                                                      ntp.util.UNITS_PPX,
-                                                     strip=True)
+                                                     strip=True,
+                                                     width=None)
         vcopy['filtdelay'] = ntp.util.filtcooker(vcopy['filtdelay'])
         vcopy['filtoffset'] = ntp.util.filtcooker(vcopy['filtoffset'])
         vcopy['filtdisp'] = ntp.util.filtcooker(vcopy['filtdisp'])


=====================================
ntpd/refclock_generic.c
=====================================
--- a/ntpd/refclock_generic.c
+++ b/ntpd/refclock_generic.c
@@ -119,7 +119,6 @@
 #include "trimble.h"
 #include "binio.h"
 #include "ascii.h"
-#include "ieee754io.h"
 #include "recvbuff.h"
 
 #define VERSION "4.81 2009/05/01 10:15:29"
@@ -146,7 +145,6 @@ struct	refclock refclock_parse = {
 /*
  * Definitions
  */
-/* #define MAXUNITS 4	* maximum number of "PARSE" units permitted UNUSED */
 #define PARSEDEVICE	"/dev/refclock-%d" /* device to open %d is unit number */
 #define PARSEPPSDEVICE	"/dev/refclockpps-%d" /* optional pps device to open %d is unit number */
 
@@ -181,8 +179,6 @@ typedef struct bind
 
 #define PARSE_END(_X_)			(*(_X_)->binding->bd_end)(_X_)
 #define PARSE_SETCS(_X_, _CS_)		(*(_X_)->binding->bd_setcs)(_X_, _CS_)
-/* #define PARSE_ENABLE(_X_)  (*(_X_)->binding->bd_enable)(_X_) UNUSED */
-/* #define PARSE_DISABLE(_X_) (*(_X_)->binding->bd_disable)(_X_) UNUSED */
 #define PARSE_GETFMT(_X_, _DCT_)	(*(_X_)->binding->bd_getfmt)(_X_, _DCT_)
 #define PARSE_SETFMT(_X_, _DCT_)	(*(_X_)->binding->bd_setfmt)(_X_, _DCT_)
 #define PARSE_GETTIMECODE(_X_, _DCT_)	(*(_X_)->binding->bd_timecode)(_X_, _DCT_)
@@ -215,7 +211,6 @@ typedef struct bind
 #define ERR_NODATA	(unsigned)1	/* no input data */
 #define ERR_BADIO	(unsigned)2	/* read/write/select errors */
 #define ERR_BADSTATUS	(unsigned)3	/* unsync states */
-/* #define ERR_BADEVENT	(unsigned)4	* non nominal events UNUSED */
 #define ERR_INTERNAL	(unsigned)5	/* internal error */
 #define ERR_CNT		(unsigned)(ERR_INTERNAL+1)
 
@@ -375,7 +370,6 @@ typedef struct poll_info
 #define NO_EVENT	0
 #define NO_LCLDATA	0
 #define NO_MESSAGE	0
-/* #define NO_PPSDELAY     0 UNUSED */
 
 #define DCF_ID		"DCF"	/* generic DCF */
 #define DCF_A_ID	"DCFa"	/* AM demodulation */
@@ -383,24 +377,6 @@ typedef struct poll_info
 #define GPS_ID		"GPS"	/* GPS receiver */
 #define MSF_ID		"MSF"	/* MSF receiver */
 
-/* #define NOCLOCK_ROOTDELAY       0.0         UNUSED */
-/* #define NOCLOCK_BASEDELAY       0.0         UNUSED */
-/* #define NOCLOCK_DESCRIPTION     0           UNUSED */
-/* #define NOCLOCK_MAXUNSYNC       0           UNUSED */
-/* #define NOCLOCK_CFLAG           0           UNUSED */
-/* #define NOCLOCK_IFLAG           0           UNUSED */
-/* #define NOCLOCK_OFLAG           0           UNUSED */
-/* #define NOCLOCK_LFLAG           0           UNUSED */
-/* #define NOCLOCK_ID              "TILT"      UNUSED */
-/* #define NOCLOCK_POLL            NO_POLL     UNUSED */
-/* #define NOCLOCK_INIT            NO_INIT     UNUSED */
-/* #define NOCLOCK_END             NO_END      UNUSED */
-/* #define NOCLOCK_DATA            NO_LCLDATA  UNUSED */
-/* #define NOCLOCK_FORMAT          ""          UNUSED */
-/* #define NOCLOCK_TYPE            CTL_SST_TS_UNSPEC UNUSED */
-/* #define NOCLOCK_SAMPLES         0           UNUSED */
-/* #define NOCLOCK_KEEP            0           UNUSED */
-
 #define DCF_TYPE		CTL_SST_TS_LF
 #define GPS_TYPE		CTL_SST_TS_UHF
 
@@ -723,7 +699,6 @@ static	void	trimbletsip_event	(struct parseunit *, int);
 #define RCC_CMDSIZE    1
 
 static poll_info_t rcc8000_pollinfo = { RCC_POLLRATE, RCC_POLLCMD, RCC_CMDSIZE };
-/* #define RCC8000_FLAGS	0 UNUSED */
 #define RCC8000_POLL            poll_dpoll
 #define RCC8000_INIT            poll_init
 #define RCC8000_END             0


=====================================
pylib/util.py
=====================================
--- a/pylib/util.py
+++ b/pylib/util.py
@@ -37,7 +37,7 @@ UNIT_US = 1
 UNIT_MS = 2
 UNIT_S = 3
 UNIT_KS = 4
-UNITS_SEC = ["ns", "us", "ms", "s", "ks"]
+UNITS_SEC = ["ns", u"\u03bcs", "ms", "s", "ks"]
 UNIT_PPT = 0
 UNIT_PPB = 1
 UNIT_PPM = 2


=====================================
tests/libparse/ieee754io.c
=====================================
--- a/tests/libparse/ieee754io.c
+++ b/tests/libparse/ieee754io.c
@@ -103,10 +103,9 @@ TEST(ieee754io, test_nan32) {
 
 TEST(ieee754io, test_max32) {
         int ret;
-        /* not enough precision in a float to get max l_fp */
-        unsigned char buf[4] = { 127, 127, 255, 255};
-        /* not enough precision in a float to get negative max l_fp */
-        unsigned char buf_n[4] = { 255, 127, 255, 255};
+        /* not enough precision in a float to get precision of l_fp */
+        unsigned char buf[4] = { 0x4e, 0xff, 255, 255};
+        unsigned char buf_n[4] = { 0xce, 0xff, 255, 255};
         unsigned char *bp = &buf[0];
         l_fp fp;
 
@@ -114,14 +113,14 @@ TEST(ieee754io, test_max32) {
         ret = fetch_ieee754( &bp, IEEE_SINGLE, &fp, native_off);
 
         TEST_ASSERT( IEEE_OK == ret);
-        TEST_ASSERT_EQUAL_UINT64( (unsigned long)0xFFFFFF00UL, fp );
+        TEST_ASSERT_EQUAL_INT64( 0x7FFFFF8000000000UL, fp );
 
         /* negative max that fits */
         bp = &buf_n[0];
         ret = fetch_ieee754( &bp, IEEE_SINGLE, &fp, native_off);
 
         TEST_ASSERT( IEEE_OK == ret);
-        TEST_ASSERT_EQUAL_UINT64( (unsigned long)0xFFFFFFFF00000100UL, fp );
+        TEST_ASSERT_EQUAL_UINT64( 0x8000008000000000UL, fp );
 }
 
 TEST(ieee754io, test_order32) {
@@ -150,7 +149,7 @@ TEST(ieee754io, test_order32) {
 TEST(ieee754io, test_small32) {
         int ret;
         /* small number, one LSB of l_fp */
-        unsigned char buf[4] = { 0x33, 255, 255, 255};
+        unsigned char buf[4] = { 0x2F, 255, 255, 255};
         unsigned char *bp = &buf[0];
         l_fp fp;
 
@@ -299,7 +298,7 @@ TEST(ieee754io, test_order64) {
 TEST(ieee754io, test_small64) {
         int ret;
         /* small number, one LSB of l_fp  */
-        unsigned char buf[8] = { 0x33, 255, 255, 255, 255, 255, 255, 255};
+        unsigned char buf[8] = { 0x3d, 255, 255, 255, 255, 255, 255, 255};
         unsigned char *bp = &buf[0];
         l_fp fp;
 


=====================================
wafhelpers/configure.py
=====================================
--- a/wafhelpers/configure.py
+++ b/wafhelpers/configure.py
@@ -279,7 +279,7 @@ def cmd_configure(ctx, config):
         # "-Wfloat-equal",   # Not Ready For Prime Time
         # "-Wmissing-prototypes",  # Not Ready For Prime Time
         # "-Wmissing-declarations", # Not Ready For Primt Time
-        "-Wsign-conversion",
+        # "-Wsign-conversion",      # fails on Solaris and OpenBSD 6
         "-Wshadow",
         "-Wstrict-prototypes",
         "-Wundef",



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/89ed97fd4dcc92c762294e78d4bedb75a75e5ffd...1d27e7ad9479e7338abdda8234126b65adff34c7
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20170406/ea9701cd/attachment.html>


More information about the vc mailing list