[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r34443 - gnunet/src/set
From: |
gnunet |
Subject: |
[GNUnet-SVN] r34443 - gnunet/src/set |
Date: |
Thu, 27 Nov 2014 15:14:24 +0100 |
Author: grothoff
Date: 2014-11-27 15:14:24 +0100 (Thu, 27 Nov 2014)
New Revision: 34443
Modified:
gnunet/src/set/gnunet-service-set_union.c
gnunet/src/set/gnunet-service-set_union_strata_estimator.c
gnunet/src/set/gnunet-service-set_union_strata_estimator.h
Log:
-dox, indentation
Modified: gnunet/src/set/gnunet-service-set_union.c
===================================================================
--- gnunet/src/set/gnunet-service-set_union.c 2014-11-27 14:10:47 UTC (rev
34442)
+++ gnunet/src/set/gnunet-service-set_union.c 2014-11-27 14:14:24 UTC (rev
34443)
@@ -17,7 +17,6 @@
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
-
/**
* @file set/gnunet-service-set_union.c
* @brief two-peer set operations
Modified: gnunet/src/set/gnunet-service-set_union_strata_estimator.c
===================================================================
--- gnunet/src/set/gnunet-service-set_union_strata_estimator.c 2014-11-27
14:10:47 UTC (rev 34442)
+++ gnunet/src/set/gnunet-service-set_union_strata_estimator.c 2014-11-27
14:14:24 UTC (rev 34443)
@@ -22,7 +22,6 @@
* @brief invertible bloom filter
* @author Florian Dold
*/
-
#include "platform.h"
#include "gnunet_util_lib.h"
#include "ibf.h"
@@ -36,9 +35,10 @@
* @param buf buffer to write to, must be of appropriate size
*/
void
-strata_estimator_write (const struct StrataEstimator *se, void *buf)
+strata_estimator_write (const struct StrataEstimator *se,
+ void *buf)
{
- int i;
+ unsigned int i;
GNUNET_assert (NULL != se);
for (i = 0; i < se->strata_count; i++)
@@ -57,9 +57,11 @@
* @param se strata estimator to write to
*/
void
-strata_estimator_read (const void *buf, struct StrataEstimator *se)
+strata_estimator_read (const void *buf,
+ struct StrataEstimator *se)
{
- int i;
+ unsigned int i;
+
for (i = 0; i < se->strata_count; i++)
{
ibf_read_slice (buf, 0, se->ibf_size, se->strata[i]);
@@ -75,10 +77,12 @@
* @param key key to add
*/
void
-strata_estimator_insert (struct StrataEstimator *se, struct IBF_Key key)
+strata_estimator_insert (struct StrataEstimator *se,
+ struct IBF_Key key)
{
uint64_t v;
- int i;
+ unsigned int i;
+
v = key.key_val;
/* count trailing '1'-bits of v */
for (i = 0; v & 1; v>>=1, i++)
@@ -94,10 +98,12 @@
* @param key key to remove
*/
void
-strata_estimator_remove (struct StrataEstimator *se, struct IBF_Key key)
+strata_estimator_remove (struct StrataEstimator *se,
+ struct IBF_Key key)
{
uint64_t v;
- int i;
+ unsigned int i;
+
v = key.key_val;
/* count trailing '1'-bits of v */
for (i = 0; v & 1; v>>=1, i++)
@@ -115,13 +121,14 @@
* @return a freshly allocated, empty strata estimator
*/
struct StrataEstimator *
-strata_estimator_create (unsigned int strata_count, uint32_t ibf_size, uint8_t
ibf_hashnum)
+strata_estimator_create (unsigned int strata_count,
+ uint32_t ibf_size,
+ uint8_t ibf_hashnum)
{
struct StrataEstimator *se;
- int i;
+ unsigned int i;
/* fixme: allocate everything in one chunk */
-
se = GNUNET_new (struct StrataEstimator);
se->strata_count = strata_count;
se->ibf_size = ibf_size;
@@ -146,7 +153,7 @@
const struct StrataEstimator *se2)
{
int i;
- int count;
+ unsigned int count;
GNUNET_assert (se1->strata_count == se2->strata_count);
count = 0;
@@ -155,6 +162,7 @@
struct InvertibleBloomFilter *diff;
/* number of keys decoded from the ibf */
int ibf_count;
+
/* FIXME: implement this without always allocating new IBFs */
diff = ibf_dup (se1->strata[i]);
ibf_subtract (diff, se2->strata[i]);
@@ -191,7 +199,7 @@
strata_estimator_dup (struct StrataEstimator *se)
{
struct StrataEstimator *c;
- int i;
+ unsigned int i;
c = GNUNET_new (struct StrataEstimator);
c->strata_count = se->strata_count;
@@ -211,7 +219,7 @@
void
strata_estimator_destroy (struct StrataEstimator *se)
{
- int i;
+ unsigned int i;
for (i = 0; i < se->strata_count; i++)
ibf_destroy (se->strata[i]);
Modified: gnunet/src/set/gnunet-service-set_union_strata_estimator.h
===================================================================
--- gnunet/src/set/gnunet-service-set_union_strata_estimator.h 2014-11-27
14:10:47 UTC (rev 34442)
+++ gnunet/src/set/gnunet-service-set_union_strata_estimator.h 2014-11-27
14:14:24 UTC (rev 34443)
@@ -45,8 +45,14 @@
*/
struct StrataEstimator
{
+
struct InvertibleBloomFilter **strata;
+
+ /**
+ * Size of the IBF array in @e strata
+ */
unsigned int strata_count;
+
unsigned int ibf_size;
};
@@ -58,7 +64,8 @@
* @param buf buffer to write to, must be of appropriate size
*/
void
-strata_estimator_write (const struct StrataEstimator *se, void *buf);
+strata_estimator_write (const struct StrataEstimator *se,
+ void *buf);
/**
@@ -69,7 +76,8 @@
* @param se strata estimator to write to
*/
void
-strata_estimator_read (const void *buf, struct StrataEstimator *se);
+strata_estimator_read (const void *buf,
+ struct StrataEstimator *se);
/**
@@ -81,7 +89,9 @@
* @return a freshly allocated, empty strata estimator
*/
struct StrataEstimator *
-strata_estimator_create (unsigned int strata_count, uint32_t ibf_size, uint8_t
ibf_hashnum);
+strata_estimator_create (unsigned int strata_count,
+ uint32_t ibf_size,
+ uint8_t ibf_hashnum);
/**
@@ -104,7 +114,8 @@
* @param key key to add
*/
void
-strata_estimator_insert (struct StrataEstimator *se, struct IBF_Key key);
+strata_estimator_insert (struct StrataEstimator *se,
+ struct IBF_Key key);
/**
@@ -114,7 +125,8 @@
* @param key key to remove
*/
void
-strata_estimator_remove (struct StrataEstimator *se, struct IBF_Key key);
+strata_estimator_remove (struct StrataEstimator *se,
+ struct IBF_Key key);
/**
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r34443 - gnunet/src/set,
gnunet <=