folly: Bits: restore type of bitOffset_ to shorter "unsigned int"
Summary:
My initial change to avoid the -Wsign-compare error neglected
the fact that the difference of two unsigned types is also
unsigned. That broke some unicorn tests, as seen in
D1776343,
which worked around the problem by changing the type of
bitOffset_ like this: s/unsigned int/size_t.
The real problem lay in the distance_to function, which computed
the signed difference of two bitOffset_ values.
To work properly with the narrower unsigned type,
we could either first widen each operand to ssize_t
before computing their parenthesized difference, or
(as Philip suggested and I prefer), just drop the
parentheses and let the signedness of the preceding
operands ensure that each successive intermediate
result is also signed.
Test Plan:
Choose one of the failing tests, and ensure it now passes:
fbconfig -r unicorn/diskindex4/test:doc_map_test
fbmake runtests
Also run all unicorn tests, for good measure (still waiting):
fbconfig -r unicorn && fbmake runtests
Reviewed By: philipp@fb.com, andrei.alexandrescu@fb.com
Subscribers: trunkagent, net-systems@, folly-diffs@
FB internal diff:
D1776624
Tasks:
5941250
Signature: t1:
1776624:
1420872874:
b1ea8a3f23f21269aa65cbe1647e86a8f622a710
Blame Revision:
D1770613