diff options
author | Nathan S. Evans <evans@in.tum.de> | 2010-08-31 14:09:16 +0000 |
---|---|---|
committer | Nathan S. Evans <evans@in.tum.de> | 2010-08-31 14:09:16 +0000 |
commit | f9adc625e2f4ee5940dd71542a8b4c30dd1a3f5c (patch) | |
tree | cc584a184fb09bc548c38fe1c5624179d6f9a3f0 /src/util/container_bloomfilter.c | |
parent | 630cb3becfc26fa786ac9567305a928771225445 (diff) | |
download | gnunet-f9adc625e2f4ee5940dd71542a8b4c30dd1a3f5c.tar.gz gnunet-f9adc625e2f4ee5940dd71542a8b4c30dd1a3f5c.zip |
broken dht compilation fix
Diffstat (limited to 'src/util/container_bloomfilter.c')
-rw-r--r-- | src/util/container_bloomfilter.c | 35 |
1 files changed, 35 insertions, 0 deletions
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 | |||
@@ -658,6 +658,41 @@ GNUNET_CONTAINER_bloomfilter_or (struct GNUNET_CONTAINER_BloomFilter *bf, | |||
658 | } | 658 | } |
659 | 659 | ||
660 | /** | 660 | /** |
661 | * Or the entries of the given raw data array with the | ||
662 | * data of the given bloom filter. Assumes that | ||
663 | * the size of the data array and the current filter | ||
664 | * match. | ||
665 | * | ||
666 | * @param bf the filter | ||
667 | * @param to_or the bloomfilter to or-in | ||
668 | * @param size number of bytes in data | ||
669 | */ | ||
670 | int | ||
671 | GNUNET_CONTAINER_bloomfilter_or2 (struct GNUNET_CONTAINER_BloomFilter *bf, | ||
672 | const struct GNUNET_CONTAINER_BloomFilter *to_or, | ||
673 | size_t size) | ||
674 | { | ||
675 | unsigned int i; | ||
676 | unsigned int n; | ||
677 | unsigned long long* fc; | ||
678 | const unsigned long long* dc; | ||
679 | |||
680 | if (NULL == bf) | ||
681 | return GNUNET_YES; | ||
682 | if (bf->bitArraySize != size) | ||
683 | return GNUNET_SYSERR; | ||
684 | fc = (unsigned long long*) bf->bitArray; | ||
685 | dc = (const unsigned long long*) to_or->bitArray; | ||
686 | n = size / sizeof (unsigned long long); | ||
687 | |||
688 | for (i = 0; i < n; i++) | ||
689 | fc[i] |= dc[i]; | ||
690 | for (i = n * sizeof(unsigned long long); i < size; i++) | ||
691 | bf->bitArray[i] |= to_or->bitArray[i]; | ||
692 | return GNUNET_OK; | ||
693 | } | ||
694 | |||
695 | /** | ||
661 | * Remove an element from the filter. | 696 | * Remove an element from the filter. |
662 | * | 697 | * |
663 | * @param bf the filter | 698 | * @param bf the filter |