From d6ddc282986099d6f25e8e423044d79c46d86e23 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Tue, 6 Jan 2015 12:40:30 -0800 Subject: [PATCH] folly/AtomicHashArray: use an unsigned type for each of two counters Summary: * folly/AtomicHashArray.h (numEntries_, numPendingEntries_): Use an unsigned type for each of these. They count things, can never go below 0, and are compared to unsigned values. Otherwise, gcc-4.9 would emit this: folly/AtomicHashArray-inl.h:153:38: 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: philipp@fb.com Subscribers: trunkagent, folly-diffs@ FB internal diff: D1770695 Tasks: 5941250 Signature: t1:1770695:1420683354:bfa4775bc2f8aab74e34772308a5c8b1779243b8 --- folly/AtomicHashArray.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/folly/AtomicHashArray.h b/folly/AtomicHashArray.h index f00e3074..373e7c5e 100644 --- a/folly/AtomicHashArray.h +++ b/folly/AtomicHashArray.h @@ -265,8 +265,8 @@ class AtomicHashArray : boost::noncopyable { // reading the value, so be careful of calling size() too frequently. This // increases insertion throughput several times over while keeping the count // accurate. - ThreadCachedInt numEntries_; // Successful key inserts - ThreadCachedInt numPendingEntries_; // Used by insertInternal + ThreadCachedInt numEntries_; // Successful key inserts + ThreadCachedInt numPendingEntries_; // Used by insertInternal std::atomic isFull_; // Used by insertInternal std::atomic numErases_; // Successful key erases -- 2.34.1