[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r6264 - GNUnet/src/util/containers
From: |
gnunet |
Subject: |
[GNUnet-SVN] r6264 - GNUnet/src/util/containers |
Date: |
Tue, 12 Feb 2008 10:19:13 -0700 (MST) |
Author: grothoff
Date: 2008-02-12 10:19:13 -0700 (Tue, 12 Feb 2008)
New Revision: 6264
Modified:
GNUnet/src/util/containers/bloomfilter.c
Log:
or
Modified: GNUnet/src/util/containers/bloomfilter.c
===================================================================
--- GNUnet/src/util/containers/bloomfilter.c 2008-02-12 07:42:00 UTC (rev
6263)
+++ GNUnet/src/util/containers/bloomfilter.c 2008-02-12 17:19:13 UTC (rev
6264)
@@ -1,6 +1,6 @@
/*
This file is part of GNUnet.
- (C) 2001, 2002, 2003, 2004, 2006 Christian Grothoff (and other
contributing authors)
+ (C) 2001, 2002, 2003, 2004, 2006, 2008 Christian Grothoff (and other
contributing authors)
GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
@@ -630,7 +630,30 @@
GNUNET_mutex_unlock (bf->lock);
}
+
/**
+ * 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
+ */
+int GNUNET_bloomfilter_or (struct GNUNET_BloomFilter *bf,
+ const char * data,
+ unsigned int size)
+{
+ unsigned int i;
+
+ if (bf->bitArraySize != size)
+ return GNUNET_SYSERR;
+ /* FIXME: we could do this 4-8x faster by
+ going over int/long arrays */
+ for (i=0;i<size;i++)
+ bf->bitArray[i] |= data[i];
+ return GNUNET_OK;
+}
+
+/**
* Remove an element from the filter.
*
* @param bf the filter
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r6264 - GNUnet/src/util/containers,
gnunet <=