broken dht compilation fix
authorNathan S. Evans <evans@in.tum.de>
Tue, 31 Aug 2010 14:09:16 +0000 (14:09 +0000)
committerNathan S. Evans <evans@in.tum.de>
Tue, 31 Aug 2010 14:09:16 +0000 (14:09 +0000)
src/util/container_bloomfilter.c

index 6e8fc78377f4db6ec600e423222752072bc60c3d..3902e431865880836578835ccc2afc33ef7f0b5e 100644 (file)
@@ -657,6 +657,41 @@ GNUNET_CONTAINER_bloomfilter_or (struct GNUNET_CONTAINER_BloomFilter *bf,
   return GNUNET_OK;
 }
 
+/**
+ * Or the entries of the given raw data array with the
+ * data of the given bloom filter.  Assumes that
+ * the size of the data array and the current filter
+ * match.
+ *
+ * @param bf the filter
+ * @param to_or the bloomfilter to or-in
+ * @param size number of bytes in data
+ */
+int
+GNUNET_CONTAINER_bloomfilter_or2 (struct GNUNET_CONTAINER_BloomFilter *bf,
+                                  const struct GNUNET_CONTAINER_BloomFilter *to_or,
+                                  size_t size)
+{
+  unsigned int i;
+  unsigned int n;
+  unsigned long long* fc;
+  const unsigned long long* dc;
+
+  if (NULL == bf)
+    return GNUNET_YES;
+  if (bf->bitArraySize != size)
+    return GNUNET_SYSERR;
+  fc = (unsigned long long*) bf->bitArray;
+  dc = (const unsigned long long*) to_or->bitArray;
+  n = size / sizeof (unsigned long long);
+
+  for (i = 0; i < n; i++)
+    fc[i] |= dc[i];
+  for (i = n * sizeof(unsigned long long); i < size; i++)
+    bf->bitArray[i] |= to_or->bitArray[i];
+  return GNUNET_OK;
+}
+
 /**
  * Remove an element from the filter.
  *