aboutsummaryrefslogtreecommitdiff
path: root/src/util/container_bloomfilter.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2010-01-18 10:09:22 +0000
committerChristian Grothoff <christian@grothoff.org>2010-01-18 10:09:22 +0000
commitc612584e0a4857df4a2820c74bf93c71e8ccb664 (patch)
tree31d7eb3ad78af0b49af8f5ea2c809d821ccca750 /src/util/container_bloomfilter.c
parentc0620b5130c9baaa8f04ba4f1e57cc37193bd1b4 (diff)
downloadgnunet-c612584e0a4857df4a2820c74bf93c71e8ccb664.tar.gz
gnunet-c612584e0a4857df4a2820c74bf93c71e8ccb664.zip
fixing fixme
Diffstat (limited to 'src/util/container_bloomfilter.c')
-rw-r--r--src/util/container_bloomfilter.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/util/container_bloomfilter.c b/src/util/container_bloomfilter.c
index 8e44f4fc6..2bdf37197 100644
--- a/src/util/container_bloomfilter.c
+++ b/src/util/container_bloomfilter.c
@@ -625,15 +625,22 @@ GNUNET_CONTAINER_bloomfilter_or (struct GNUNET_CONTAINER_BloomFilter *bf,
625 const char *data, size_t size) 625 const char *data, size_t size)
626{ 626{
627 unsigned int i; 627 unsigned int i;
628 unsigned int n;
629 unsigned long long* fc;
630 const unsigned long long* dc;
628 631
629 if (NULL == bf) 632 if (NULL == bf)
630 return GNUNET_YES; 633 return GNUNET_YES;
631 if (bf->bitArraySize != size) 634 if (bf->bitArraySize != size)
632 return GNUNET_SYSERR; 635 return GNUNET_SYSERR;
633 /* FIXME: we could do this 4-8x faster by 636 fc = (unsigned long long*) bf->bitArray;
634 going over int/long arrays */ 637 dc = (const unsigned long long*) data;
635 for (i = 0; i < size; i++) 638 n = size / sizeof (unsigned long long);
636 bf->bitArray[i] |= data[i]; 639
640 for (i = 0; i < n; i++)
641 fc[i] |= dc[i];
642 for (i = n * sizeof(unsigned long long); i < size; i++)
643 bf->bitArray[i] |= data[i]
637 return GNUNET_OK; 644 return GNUNET_OK;
638} 645}
639 646