Repository: lucy
Updated Branches:
  refs/heads/master 54841aa79 -> 4370756cc


Fix bit-to-byte-size routine.


Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/7edcd1cf
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/7edcd1cf
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/7edcd1cf

Branch: refs/heads/master
Commit: 7edcd1cfcbedfe2beffdcf8b270b81f23074dc84
Parents: 66aba12
Author: Marvin Humphrey <[email protected]>
Authored: Wed Apr 13 15:55:42 2016 -0700
Committer: Marvin Humphrey <[email protected]>
Committed: Wed Apr 13 16:10:59 2016 -0700

----------------------------------------------------------------------
 core/Lucy/Object/BitVector.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy/blob/7edcd1cf/core/Lucy/Object/BitVector.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Object/BitVector.c b/core/Lucy/Object/BitVector.c
index 0afcc71..22c5487 100644
--- a/core/Lucy/Object/BitVector.c
+++ b/core/Lucy/Object/BitVector.c
@@ -48,10 +48,8 @@ static const uint32_t BYTE_COUNTS[256] = {
 
 static CFISH_INLINE size_t
 SI_octet_size(size_t bit_size) {
-    if (bit_size > SIZE_MAX - 8) {
-        return SIZE_MAX / 8;
-    }
-    return (bit_size + 7) / 8;
+    if (bit_size == 0) { return 0; }
+    return (bit_size - 1) / 8 + 1;
 }
 
 BitVector*

Reply via email to