summaryrefslogtreecommitdiff
path: root/absl
diff options
context:
space:
mode:
authorGravatar Dominic Chen <1108560+ddcc@users.noreply.github.com>2020-09-30 17:08:44 -0400
committerGravatar GitHub <noreply@github.com>2020-09-30 17:08:44 -0400
commit40fdb59d37116d3299ff2d69cf7697f23864d8d5 (patch)
treeeb3b2f37840af38e3833569801e6add59ec25cdb /absl
parent1fd58b69c62d1bb590a4860b0db30212b2fd2af4 (diff)
btree: fix sign-compare warnings (#800)
Diffstat (limited to 'absl')
-rw-r--r--absl/container/internal/btree.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/absl/container/internal/btree.h b/absl/container/internal/btree.h
index 2e291d31..55d69572 100644
--- a/absl/container/internal/btree.h
+++ b/absl/container/internal/btree.h
@@ -2278,11 +2278,11 @@ void btree<P>::rebalance_or_split(iterator *iter) {
// inserting at the end of the right node then we bias rebalancing to
// fill up the left node.
int to_move = (kNodeValues - left->count()) /
- (1 + (insert_position < kNodeValues));
+ (1 + (insert_position < static_cast<int>(kNodeValues)));
to_move = (std::max)(1, to_move);
if (insert_position - to_move >= node->start() ||
- left->count() + to_move < kNodeValues) {
+ left->count() + to_move < static_cast<int>(kNodeValues)) {
left->rebalance_right_to_left(to_move, node, mutable_allocator());
assert(node->max_count() - node->count() == to_move);
@@ -2306,12 +2306,12 @@ void btree<P>::rebalance_or_split(iterator *iter) {
// We bias rebalancing based on the position being inserted. If we're
// inserting at the beginning of the left node then we bias rebalancing
// to fill up the right node.
- int to_move = (kNodeValues - right->count()) /
+ int to_move = (static_cast<int>(kNodeValues) - right->count()) /
(1 + (insert_position > node->start()));
to_move = (std::max)(1, to_move);
if (insert_position <= node->finish() - to_move ||
- right->count() + to_move < kNodeValues) {
+ right->count() + to_move < static_cast<int>(kNodeValues)) {
node->rebalance_left_to_right(to_move, right, mutable_allocator());
if (insert_position > node->finish()) {
@@ -2374,7 +2374,7 @@ bool btree<P>::try_merge_or_rebalance(iterator *iter) {
// Try merging with our left sibling.
node_type *left = parent->child(iter->node->position() - 1);
assert(left->max_count() == kNodeValues);
- if (1 + left->count() + iter->node->count() <= kNodeValues) {
+ if (1U + left->count() + iter->node->count() <= kNodeValues) {
iter->position += 1 + left->count();
merge_nodes(left, iter->node);
iter->node = left;
@@ -2385,7 +2385,7 @@ bool btree<P>::try_merge_or_rebalance(iterator *iter) {
// Try merging with our right sibling.
node_type *right = parent->child(iter->node->position() + 1);
assert(right->max_count() == kNodeValues);
- if (1 + iter->node->count() + right->count() <= kNodeValues) {
+ if (1U + iter->node->count() + right->count() <= kNodeValues) {
merge_nodes(iter->node, right);
return true;
}