Typing changes in the LockFreeRingBuffer to support 64/32 bit iOS architectures.
authorBryce Redd <bryceredd@fb.com>
Fri, 11 Sep 2015 22:46:05 +0000 (15:46 -0700)
committerfacebook-github-bot-1 <folly-bot@fb.com>
Fri, 11 Sep 2015 23:20:17 +0000 (16:20 -0700)
Summary: The capacity variable changed types, and turn function needed an explicit cast.

Reviewed By: @BurntBrunch

Differential Revision: D2421421

folly/experimental/LockFreeRingBuffer.h

index f8dff773c317eafb3af13bb26bebd7da09c13815..8d7bcc01be8033fc07a683590d42c3367e44e046 100644 (file)
@@ -87,7 +87,7 @@ public:
     friend class LockFreeRingBuffer;
   };
 
-  explicit LockFreeRingBuffer(size_t capacity) noexcept
+  explicit LockFreeRingBuffer(uint32_t capacity) noexcept
     : capacity_(capacity)
     , slots_(new detail::RingBufferSlot<T,Atom>[capacity])
     , ticket_(0)
@@ -145,7 +145,7 @@ public:
   }
 
 private:
-  const size_t capacity_;
+  const uint32_t capacity_;
 
   const std::unique_ptr<detail::RingBufferSlot<T,Atom>[]> slots_;
 
@@ -156,7 +156,7 @@ private:
   }
 
   uint32_t turn(uint64_t ticket) noexcept {
-    return (ticket / capacity_);
+    return (uint32_t)(ticket / capacity_);
   }
 }; // LockFreeRingBuffer