[Git][NTPsec/ntpsec][master] Information hiding.

Eric S. Raymond gitlab at mg.gitlab.com
Mon Dec 26 20:23:53 UTC 2016


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


Commits:
7becd9ba by Eric S. Raymond at 2016-12-26T15:23:21-05:00
Information hiding.

- - - - -


2 changed files:

- include/ntp_fp.h
- ntpd/refclock_generic.c


Changes:

=====================================
include/ntp_fp.h
=====================================
--- a/include/ntp_fp.h
+++ b/include/ntp_fp.h
@@ -188,14 +188,6 @@ typedef uint32_t u_fp;
 #define	M_ISNEG(v_i)			/* v < 0 */ \
 	(((v_i) & 0x80000000) != 0)
 
-#define	M_ISGT(a_i, a_f, b_i, b_f)	/* a > b signed */ \
-	(((uint32_t)((a_i) ^ 0x80000000) > (uint32_t)((b_i) ^ 0x80000000)) || \
-	  ((a_i) == (b_i) && ((uint32_t)(a_f)) > ((uint32_t)(b_f))))
-
-#define	M_ISGEQ(a_i, a_f, b_i, b_f)	/* a >= b signed */ \
-	(((uint32_t)((a_i) ^ 0x80000000) > (uint32_t)((b_i) ^ 0x80000000)) || \
-	  ((a_i) == (b_i) && (uint32_t)(a_f) >= (uint32_t)(b_f)))
-
 /*
  * Operations on the long fp format
  * FIXME: Using lfpuint(x) as rvalue, this will fail when representation changes.
@@ -209,9 +201,9 @@ typedef uint32_t u_fp;
 #define	L_CLR(v)	(setlfpuint(*v, 0), setlfpfrac(*v, 0))
 #define	L_ISNEG(v)	M_ISNEG(lfpuint(*v))
 #define L_ISZERO(v)	((lfpuint(*v) | lfpfrac(*v)) == 0)
-#define	L_ISGT(a, b)	M_ISGT(lfpsint(*a), lfpfrac(*a), lfpsint(*b), lfpfrac(*b))
+#define	L_ISGT(a, b)	((int64_t)lfp_to_uint64(*a) > (int64_t)lfp_to_uint64(*b))
 #define	L_ISGTU(a, b)	(lfp_to_uint64(*a) > lfp_to_uint64(*b))
-#define	L_ISGEQ(a, b)	M_ISGEQ(lfpuint(*a), lfpfrac(*a), lfpuint(*b), lfpfrac(*b))
+#define	L_ISGEQ(a, b)	((int64_t)lfp_to_uint64(*a) >= (int64_t)lfp_to_uint64(*b))
 #define L_ISGEQU(a, b)  (lfp_to_uint64(*a) >= lfp_to_uint64(*b))
 #define	L_ISEQU(a, b)	(lfp_to_uint64(*a) == lfp_to_uint64(*b))
 


=====================================
ntpd/refclock_generic.c
=====================================
--- a/ntpd/refclock_generic.c
+++ b/ntpd/refclock_generic.c
@@ -3509,6 +3509,9 @@ parse_process(
 #endif
 		if (PARSE_TIMECODE(parsetime->parse_state))
 		{
+#define	M_ISGEQ(a_i, a_f, b_i, b_f)	/* a >= b signed */ \
+	(((uint32_t)((a_i) ^ 0x80000000) > (uint32_t)((b_i) ^ 0x80000000)) || \
+	  ((a_i) == (b_i) && (uint32_t)(a_f) >= (uint32_t)(b_f)))
 			if (M_ISGEQ(lfpsint(off), lfpfrac(off), -1, 0x80000000) &&
 			    M_ISGEQ(0, 0x7fffffff, lfpsint(off), lfpfrac(off)))
 			{



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/7becd9ba3986486f92a50722a2c9d4bd5ab77fe8
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20161226/e51ca6b7/attachment.html>


More information about the vc mailing list