fix liger contbuild: cast offset_bytes to unsigned
authorYang Chi <yangchi@fb.com>
Fri, 4 Mar 2016 16:54:08 +0000 (08:54 -0800)
committerFacebook Github Bot 6 <facebook-github-bot-6-bot@fb.com>
Fri, 4 Mar 2016 17:05:19 +0000 (09:05 -0800)
Summary: Apparently I don't know what I'm doing. But given lock_ is 8bit and the assert, I suppose cast offset_bytes to unsigned is safe.

Reviewed By: dcolascione

Differential Revision: D3010732

fb-gh-sync-id: 1f3440a72d2f0b2fb145ab36966f0382a3009e0c
shipit-source-id: 1f3440a72d2f0b2fb145ab36966f0382a3009e0c

folly/MicroLock.h

index d5529af0951618951e4061ef8f028c9107da7552..18efaa9b80d7a308ff1379388536e1b196d3e1c8 100644 (file)
@@ -17,7 +17,7 @@
 #pragma once
 
 #include <assert.h>
-#include <limits>
+#include <climits>
 #include <stdint.h>
 #include <folly/detail/Futex.h>
 #include <folly/Portability.h>
@@ -114,7 +114,7 @@ inline unsigned MicroLockCore::baseShift(unsigned slot) const {
   assert(offset_bytes < sizeof(uint32_t));
 
   return kIsLittleEndian
-             ? offset_bytes * CHAR_BIT + slot * 2
+             ? (unsigned)offset_bytes * CHAR_BIT + slot * 2
              : CHAR_BIT * (sizeof(uint32_t) - offset_bytes - 1) + slot * 2;
 }