[Git][NTPsec/ntpsec][master] More vint64 encapaulation - eliminate bad interaction with M_NEG macro.

Eric S. Raymond gitlab at mg.gitlab.com
Sun Sep 25 18:19:19 UTC 2016


Eric S. Raymond pushed to branch master at NTPsec / ntpsec


Commits:
cceea0f1 by Eric S. Raymond at 2016-09-25T14:18:28-04:00
More vint64 encapaulation - eliminate bad interaction with M_NEG macro.

- - - - -


3 changed files:

- include/ntp_types.h
- libntp/ntp_calendar.c
- libntp/vint64ops.c


Changes:

=====================================
include/ntp_types.h
=====================================
--- a/include/ntp_types.h
+++ b/include/ntp_types.h
@@ -80,6 +80,7 @@ typedef union {
 #define setvint64s(n,v)   (n).q_s = (v)
 #define vint64u(n)        (n).Q_s
 #define setvint64u(n,v)   (n).Q_s = (v)
+#define negvint64(n)      (n).q_s *= -1
 
 typedef uint16_t	associd_t; /* association ID */
 #define ASSOCID_MAX	USHRT_MAX


=====================================
libntp/ntp_calendar.c
=====================================
--- a/libntp/ntp_calendar.c
+++ b/libntp/ntp_calendar.c
@@ -68,7 +68,7 @@ time_to_vint64(
 	setvint64hiu(res, 0);
 	if (tt < 0) {
 		setvint64lo(res, (uint32_t)-tt);
-		M_NEG(vint64hiu(res), vint64lo(res));
+		negvint64(res);
 	} else {
 		setvint64lo(res, (uint32_t)tt);
 	}


=====================================
libntp/vint64ops.c
=====================================
--- a/libntp/vint64ops.c
+++ b/libntp/vint64ops.c
@@ -102,7 +102,7 @@ strtouv64(
 	if (endp)
 		*endp = (char*)noconst(src);
 	if (sig)
-		M_NEG(vint64hiu(res), vint64lo(res));
+		negvint64(res);
 	return res;
 }
 



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/cceea0f1bd04b98115a8b091e6d522a10d4dfcf7
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/vc/attachments/20160925/8ce039b2/attachment.html>


More information about the vc mailing list