use c99
[oweals/gnunet.git] / src / set / gnunet-service-set_union.c
index 6fd609b77c1574b32233bbbd0ad08fff435b4182..aeb706ec3d4c3b96cd9271e47de7de30ca1af46e 100644 (file)
@@ -1,6 +1,6 @@
 /*
       This file is part of GNUnet
-      Copyright (C) 2013-2015 Christian Grothoff (and other contributing authors)
+      Copyright (C) 2013-2015 GNUnet e.V.
 
       GNUnet is free software; you can redistribute it and/or modify
       it under the terms of the GNU General Public License as published
@@ -18,7 +18,7 @@
       Boston, MA 02110-1301, USA.
 */
 /**
- * @file set/gnunet-service-set_union.c    msg->salt = htonl (op->state->salt_send);
+ * @file set/gnunet-service-set_union.c
 
  * @brief two-peer set operations
  * @author Florian Dold
@@ -454,6 +454,7 @@ salt_key (const struct IBF_Key *k_in,
 {
   int s = salt % 64;
   uint64_t x = k_in->key_val;
+  /* rotate ibf key */
   x = (x >> s) | (x << (64 - s));
   k_out->key_val = x;
 }
@@ -464,9 +465,9 @@ unsalt_key (const struct IBF_Key *k_in,
             uint32_t salt, 
             struct IBF_Key *k_out)
 {
-  int s = -(salt % 64);
+  int s = salt % 64;
   uint64_t x = k_in->key_val;
-  x = (x >> s) | (x << (64 - s));
+  x = (x << s) | (x >> (64 - s));
   k_out->key_val = x;
 }
 
@@ -1025,6 +1026,7 @@ handle_p2p_ibf (void *cls,
          1 << msg->order);
     op->state->remote_ibf = ibf_create (1<<msg->order, SE_IBF_HASH_NUM);
     op->state->salt_receive = ntohl (msg->salt);
+    LOG (GNUNET_ERROR_TYPE_DEBUG, "Receiving new IBF with salt %u\n", op->state->salt_receive);
     if (NULL == op->state->remote_ibf)
     {
       GNUNET_log (GNUNET_ERROR_TYPE_ERROR,