Commit 0a9f6eef authored by Jim Meyering's avatar Jim Meyering Committed by Viswanath Sivakumar

folly/Bits.h (BitIterator): avoid -Wsign-compare error

Summary:
* folly/Bits.h (BitIterator) [bitOffset_]: Change type of this
member from ssize_t to "unsigned int".
(bitsPerBlock): Change return type from size_t to "unsigned int".
These changes avoid some -Wsign-compare-highlighted issues, e.g.,
folly/Bits.h:456:18: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]

Test Plan:
Run this and note there are fewer errors than before:
fbconfig --platform-all=gcc-4.9-glibc-2.20 -r folly && fbmake dbgo

I've also run "fbmake runtests", and it failed precisely the way it does
without this patch.

Reviewed By: andrei.alexandrescu@fb.com

Subscribers: trunkagent, net-systems@, folly-diffs@

FB internal diff: D1770613

Tasks: 5941250

Signature: t1:1770613:1420757397:7ee7e5de500c8991af2597a6245d12d8f286b4b7
parent 377e3f4c
...@@ -436,7 +436,7 @@ class BitIterator ...@@ -436,7 +436,7 @@ class BitIterator
/** /**
* Return the number of bits in an element of the underlying iterator. * Return the number of bits in an element of the underlying iterator.
*/ */
static size_t bitsPerBlock() { static unsigned int bitsPerBlock() {
return std::numeric_limits< return std::numeric_limits<
typename std::make_unsigned< typename std::make_unsigned<
typename std::iterator_traits<BaseIter>::value_type typename std::iterator_traits<BaseIter>::value_type
...@@ -525,7 +525,7 @@ class BitIterator ...@@ -525,7 +525,7 @@ class BitIterator
(other.bitOffset_ - bitOffset_); (other.bitOffset_ - bitOffset_);
} }
ssize_t bitOffset_; unsigned int bitOffset_;
}; };
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment