diff options
author | Keith Bostic <keith@wiredtiger.com> | 2015-05-02 13:20:13 -0400 |
---|---|---|
committer | Keith Bostic <keith@wiredtiger.com> | 2015-05-02 13:20:13 -0400 |
commit | 7c00702d1fe45d51b3ecc2319069f488807a5d34 (patch) | |
tree | 23c828e89635bb209a99d8c5afbc971fd77f760c /ext | |
parent | a5faf35fa0a6a6580d9fb5d2885e90a81f0a83db (diff) | |
download | mongo-7c00702d1fe45d51b3ecc2319069f488807a5d34.tar.gz |
Move the find_slot function near the compress-raw function, its only
caller.
Diffstat (limited to 'ext')
-rw-r--r-- | ext/compressors/zlib/zlib_compress.c | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/ext/compressors/zlib/zlib_compress.c b/ext/compressors/zlib/zlib_compress.c index 381bf0d5070..d240f23d43b 100644 --- a/ext/compressors/zlib/zlib_compress.c +++ b/ext/compressors/zlib/zlib_compress.c @@ -154,32 +154,6 @@ zlib_compress(WT_COMPRESSOR *compressor, WT_SESSION *session, } /* - * zlib_find_slot -- - * Find the slot containing the target offset (binary search). - */ -static inline uint32_t -zlib_find_slot(uint64_t target, uint32_t *offsets, uint32_t slots) -{ - uint32_t base, indx, limit; - - indx = 1; - - /* Figure out which slot we got to: binary search */ - if (target >= offsets[slots]) - indx = slots; - else if (target > offsets[1]) - for (base = 2, limit = slots - base; limit != 0; limit >>= 1) { - indx = base + (limit >> 1); - if (target < offsets[indx]) - continue; - base = indx + 1; - --limit; - } - - return (indx); -} - -/* * zlib_decompress -- * WiredTiger zlib decompression. */ @@ -222,6 +196,32 @@ zlib_decompress(WT_COMPRESSOR *compressor, WT_SESSION *session, } /* + * zlib_find_slot -- + * Find the slot containing the target offset (binary search). + */ +static inline uint32_t +zlib_find_slot(uint64_t target, uint32_t *offsets, uint32_t slots) +{ + uint32_t base, indx, limit; + + indx = 1; + + /* Figure out which slot we got to: binary search */ + if (target >= offsets[slots]) + indx = slots; + else if (target > offsets[1]) + for (base = 2, limit = slots - base; limit != 0; limit >>= 1) { + indx = base + (limit >> 1); + if (target < offsets[indx]) + continue; + base = indx + 1; + --limit; + } + + return (indx); +} + +/* * zlib_compress_raw -- * Pack records into a specified on-disk page size. */ |