]> git.ozlabs.org Git - ccan/blobdiff - ccan/alloc/tiny.c
tdb2: copy tdb1's changed expansion logic.
[ccan] / ccan / alloc / tiny.c
index c27c601f5aa1fb59b448ff0dc000af322a5a8bd6..ffd17c65734f881f1ca355ed9e1a5b705dd3ff46 100644 (file)
@@ -1,3 +1,4 @@
+/* Licensed under LGPLv2.1+ - see LICENSE file for details */
 #include "tiny.h"
 #include "bitops.h"
 #include <assert.h>
 #include "tiny.h"
 #include "bitops.h"
 #include <assert.h>
@@ -19,7 +20,7 @@
 /* Val is usually offset by MIN_BLOCK_SIZE here. */
 static unsigned encode_length(unsigned long val)
 {
 /* Val is usually offset by MIN_BLOCK_SIZE here. */
 static unsigned encode_length(unsigned long val)
 {
-       unsigned int bits = fls(val);
+       unsigned int bits = afls(val);
        /* 5 bits in first byte. */
        if (bits <= 5)
                return 1;
        /* 5 bits in first byte. */
        if (bits <= 5)
                return 1;