[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnunet] 14/17: improve comments
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnunet] 14/17: improve comments |
Date: |
Mon, 09 Jan 2017 21:19:20 +0100 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository gnunet.
commit f12a7fb70153815db528e9ff48088479b3313da3
Author: Christian Grothoff <address@hidden>
AuthorDate: Mon Jan 9 17:48:52 2017 +0100
improve comments
---
src/cadet/cadet.h | 12 +++++++++---
src/cadet/cadet_common.c | 15 ++++++++++++---
2 files changed, 21 insertions(+), 6 deletions(-)
diff --git a/src/cadet/cadet.h b/src/cadet/cadet.h
index 049f3a85a..f3f6fb6b4 100644
--- a/src/cadet/cadet.h
+++ b/src/cadet/cadet.h
@@ -67,10 +67,16 @@ extern "C"
#define GNUNET_CADET_LOCAL_CHANNEL_ID_CLI 0x80000000
#define GNUNET_CADET_LOCAL_CHANNEL_ID_SERV 0xB0000000
-#define HIGH_PID 0xFFFF0000
-#define LOW_PID 0x0000FFFF
+#define HIGH_PID 0xFF000000
+#define LOW_PID 0x00FFFFFF
-#define PID_OVERFLOW(pid, max) (pid > HIGH_PID && max < LOW_PID)
+/**
+ * Test if the two PIDs (of type `uint32_t`) are in the range where we
+ * have to worry about overflows. This is the case when @a pid is
+ * large and @a max is small, useful when comparing @a pid smaller
+ * than @a max.
+ */
+#define PID_OVERFLOW(pid, max) (((pid) > HIGH_PID) && ((max) < LOW_PID))
/******************************************************************************/
/************************** MESSAGES
******************************/
diff --git a/src/cadet/cadet_common.c b/src/cadet/cadet_common.c
index a9d9a35be..20ee7e5c9 100644
--- a/src/cadet/cadet_common.c
+++ b/src/cadet/cadet_common.c
@@ -51,11 +51,20 @@ GC_f2s (int fwd)
}
}
+
+/**
+ * Test if @a bigger is larger than @a smaller.
+ * Considers the case that @a bigger just overflowed
+ * and is thus tiny while @a smaller is still below
+ * `UINT32_MAX`.
+ */
int
-GC_is_pid_bigger (uint32_t bigger, uint32_t smaller)
+GC_is_pid_bigger (uint32_t bigger,
+ uint32_t smaller)
{
- return (GNUNET_YES == PID_OVERFLOW (smaller, bigger) ||
- (bigger > smaller && GNUNET_NO == PID_OVERFLOW (bigger, smaller)));
+ return (PID_OVERFLOW (smaller, bigger) ||
+ ( (bigger > smaller) &&
+ (! PID_OVERFLOW (bigger, smaller))) );
}
--
To stop receiving notification emails like this one, please contact
address@hidden
- [GNUnet-SVN] [gnunet] 07/17: rename new core API implementation to name of standard implementation, (continued)
- [GNUnet-SVN] [gnunet] 07/17: rename new core API implementation to name of standard implementation, gnunet, 2017/01/09
- [GNUnet-SVN] [gnunet] 08/17: rename new client API implementation to name of standard implementation, gnunet, 2017/01/09
- [GNUnet-SVN] [gnunet] 04/17: dead code elimination, gnunet, 2017/01/09
- [GNUnet-SVN] [gnunet] 03/17: handle transmissions initiated during disconnect callbacks by dropping, gnunet, 2017/01/09
- [GNUnet-SVN] [gnunet] 12/17: enable upnpc by default, gnunet, 2017/01/09
- [GNUnet-SVN] [gnunet] 01/17: out-of-order PIDs are not exactly protocol violations, hence do not report as such, gnunet, 2017/01/09
- [GNUnet-SVN] [gnunet] 10/17: fix link issue, gnunet, 2017/01/09
- [GNUnet-SVN] [gnunet] 09/17: log at DEBUG level, gnunet, 2017/01/09
- [GNUnet-SVN] [gnunet] 02/17: cancel potentially dangling reconnect task, gnunet, 2017/01/09
- [GNUnet-SVN] [gnunet] 16/17: do not attempt to publish empty HELLOs, gnunet, 2017/01/09
- [GNUnet-SVN] [gnunet] 14/17: improve comments,
gnunet <=
- [GNUnet-SVN] [gnunet] 17/17: cosmetics, gnunet, 2017/01/09
- [GNUnet-SVN] [gnunet] 11/17: eliminate dead NAT options, gnunet, 2017/01/09
- [GNUnet-SVN] [gnunet] 06/17: remove legacy core api code (now dead), gnunet, 2017/01/09