folly/small_vector.h: avoid -Wsign-compare error
authorJim Meyering <meyering@fb.com>
Tue, 6 Jan 2015 23:32:33 +0000 (15:32 -0800)
committerViswanath Sivakumar <viswanath@fb.com>
Tue, 13 Jan 2015 19:01:04 +0000 (11:01 -0800)
commit67a4edadf17fc386d11fc26c5c47d0da12c0be48
tree53c6f79e27a66204d29fe1889b39eaa365cd2145
parentb6c430e1dea510e56cc170bdcf68018c6ad083c3
folly/small_vector.h: avoid -Wsign-compare error

Summary:
* folly/small_vector.h (moveToUninitialized): Do not mix
signed and unsigned for-loop index/limit.  Instead, eliminate
the intermediate "count" altogether and iterate as long as
"first" is not equal to "last". Otherwise, gcc-4.9 fails with e.g.,
folly/small_vector.h:115: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

Reviewed By: soren@fb.com

Subscribers: trunkagent, folly-diffs@

FB internal diff: D1767844

Tasks: 5941250

Signature: t1:1767844:1420601608:987fd7f7d44197ed9919910c9b559b37fbe421b6
folly/small_vector.h