Blob Blame History Raw
commit 5f295cd05c3c136d39f5b3e500a2d781bdbb59c8
Author:  <stenn@deacon.udel.edu>
Date:   Wed Apr 24 19:13:53 2013 -0400

    [Bug 2382] Implement LOGTOD using ldexp() instead of shifting

diff --git a/include/ntp.h b/include/ntp.h
index aa45e16..95b2542 100644
--- a/include/ntp.h
+++ b/include/ntp.h
@@ -156,10 +156,9 @@ typedef char s_char;
 #define SQUARE(x) ((x) * (x))
 #define SQRT(x) (sqrt(x))
 #define DIFF(x, y) (SQUARE((x) - (y)))
-#define LOGTOD(a)	((a) < 0 ? 1. / (1L << -(a)) : \
-			    1L << (int)(a)) /* log2 to double */
+#define LOGTOD(a)	ldexp(1., (int)(a)) /* log2 to double */
 #define UNIVAR(x)	(SQUARE(.28867513 * LOGTOD(x))) /* std uniform distr */
-#define ULOGTOD(a)	(1L << (int)(a)) /* ulog2 to double */
+#define ULOGTOD(a)	ldexp(1., (int)(a)) /* ulog2 to double */
 
 #define	EVENT_TIMEOUT	0	/* one second, that is */