From f9adc625e2f4ee5940dd71542a8b4c30dd1a3f5c Mon Sep 17 00:00:00 2001 From: "Nathan S. Evans" Date: Tue, 31 Aug 2010 14:09:16 +0000 Subject: broken dht compilation fix --- src/util/container_bloomfilter.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'src/util/container_bloomfilter.c') diff --git a/src/util/container_bloomfilter.c b/src/util/container_bloomfilter.c index 6e8fc7837..3902e4318 100644 --- a/src/util/container_bloomfilter.c +++ b/src/util/container_bloomfilter.c @@ -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. * -- cgit v1.2.3