[Git][NTPsec/ntpsec][master] Inline a grotty macro that is now only used once.

Eric S. Raymond gitlab at mg.gitlab.com
Mon Jan 23 10:42:21 UTC 2017


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


Commits:
983a7c5f by Eric S. Raymond at 2017-01-23T05:41:13-05:00
Inline a grotty macro that is now only used once.

- - - - -


2 changed files:

- include/ntp_fp.h
- libntp/atolfp.c


Changes:

=====================================
include/ntp_fp.h
=====================================
--- a/include/ntp_fp.h
+++ b/include/ntp_fp.h
@@ -106,18 +106,6 @@ static inline l_fp ntohl_fp(l_fp_w lfpw) {
     return lfpinit(ntohl(lfpw.l_ui), ntohl(lfpw.l_uf));
 }
 
-/*
- * Primitive operations on long fixed point values.  If these are
- * reminiscent of assembler op codes it's only because some may
- * be replaced by inline assembler for particular machines someday.
- * These are the (kind of inefficient) run-anywhere versions.
- */
-#define	M_NEG(v_i, v_f)		/* v = -v */ \
-	do { \
-		(v_f) = ~(v_f) + 1u; \
-		(v_i) = ~(v_i) + ((v_f) == 0); \
-	} while (false)
-
 #define	M_ISNEG(v_i)			/* v < 0 */ \
 	(((v_i) & 0x80000000) != 0)
 


=====================================
libntp/atolfp.c
=====================================
--- a/libntp/atolfp.c
+++ b/libntp/atolfp.c
@@ -114,8 +114,11 @@ atolfp(
 	}
 
 	if (isneg)
-	    M_NEG(dec_i, dec_f);
-	
+	{
+		(dec_f) = ~(dec_f) + 1u;
+		(dec_i) = ~(dec_i) + ((dec_f) == 0);
+	}
+
 	*lfp = lfpinit(dec_i, dec_f);
 	return true;
 }



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/983a7c5fb12ddd68ea5deb6be428fc2a7c783287
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20170123/9d2c39b4/attachment.html>


More information about the vc mailing list