[tor-commits] [tor/master] Move bool_eq and bool_neq to lib/intmath

nickm at torproject.org nickm at torproject.org
Fri Jun 29 16:59:55 UTC 2018


commit 77bc65bbc495095d4d2679631e06a498ea1e2529
Author: Nick Mathewson <nickm at torproject.org>
Date:   Fri Jun 29 10:21:50 2018 -0400

    Move bool_eq and bool_neq to lib/intmath
---
 src/common/util.h          |  7 +------
 src/lib/intmath/include.am |  1 +
 src/lib/intmath/logic.h    | 14 ++++++++++++++
 3 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/src/common/util.h b/src/common/util.h
index 9f387150a..c59c79c30 100644
--- a/src/common/util.h
+++ b/src/common/util.h
@@ -30,6 +30,7 @@
 #include "lib/string/scanf.h"
 #include "lib/intmath/bits.h"
 #include "lib/intmath/addsub.h"
+#include "lib/intmath/logic.h"
 #include "lib/intmath/muldiv.h"
 #include "lib/intmath/cmp.h"
 #include "lib/log/ratelim.h"
@@ -54,12 +55,6 @@
 #define SUBTYPE_P(p, subtype, basemember) \
   ((void*) ( ((char*)(p)) - offsetof(subtype, basemember) ))
 
-/* Logic */
-/** Macro: true if two values have the same boolean value. */
-#define bool_eq(a,b) (!(a)==!(b))
-/** Macro: true if two values have different boolean values. */
-#define bool_neq(a,b) (!(a)!=!(b))
-
 /* Math functions */
 
 /* String manipulation */
diff --git a/src/lib/intmath/include.am b/src/lib/intmath/include.am
index 1ae5d618d..45ee3bd53 100644
--- a/src/lib/intmath/include.am
+++ b/src/lib/intmath/include.am
@@ -20,5 +20,6 @@ noinst_HEADERS +=					\
 	src/lib/intmath/addsub.h			\
 	src/lib/intmath/cmp.h				\
 	src/lib/intmath/bits.h				\
+	src/lib/intmath/logic.h				\
 	src/lib/intmath/muldiv.h			\
 	src/lib/intmath/weakrng.h
diff --git a/src/lib/intmath/logic.h b/src/lib/intmath/logic.h
new file mode 100644
index 000000000..0510a621d
--- /dev/null
+++ b/src/lib/intmath/logic.h
@@ -0,0 +1,14 @@
+/* Copyright (c) 2003-2004, Roger Dingledine
+ * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
+ * Copyright (c) 2007-2018, The Tor Project, Inc. */
+/* See LICENSE for licensing information */
+
+#ifndef HAVE_TOR_LOGIC_H
+#define HAVE_TOR_LOGIC_H
+
+/** Macro: true if two values have the same boolean value. */
+#define bool_eq(a,b) (!(a)==!(b))
+/** Macro: true if two values have different boolean values. */
+#define bool_neq(a,b) (!(a)!=!(b))
+
+#endif





More information about the tor-commits mailing list