minor, clarify usage of ase_ffsl in skiplist.c
authorSebastian Freundt <freundt@ga-group.nl>
Thu, 5 Apr 2012 13:54:35 +0000 (13:54 +0000)
committerSebastian Freundt <freundt@ga-group.nl>
Thu, 5 Apr 2012 14:09:51 +0000 (14:09 +0000)
Signed-off-by: Sebastian Freundt <freundt@ga-group.nl>
src/skiplist.c

index 65f43c1..d073287 100644 (file)
@@ -561,8 +561,10 @@ _put_skiplist(skiplist_t sl, skiplist_level_t *path, size_t psz,
              hcode_t h, Lisp_Object key, Lisp_Object value)
 {
        /* entirely new data, build a node for it */
-       /* determine the number of levels to add */
-       size_t nlevels = __ase_ffsl(random()), cnt;
+       /* determine the number of levels to add, this is a log distribution
+        * so we use ffs(3) of a random number */
+       size_t nlevels = __ase_ffsl(random());
+       size_t cnt;
        skiplist_level_t levels, last = path[psz--];
        skiplist_node_t node;