Skip to content

Commit acbd3f1

Browse files
yfeldblumfacebook-github-bot
authored andcommitted
fix violations of implicit-int-conversion in MicroLock
Reviewed By: ot Differential Revision: D76691047 fbshipit-source-id: 95ccd43d11ff5a23347e9b4f75b16a5a46ef47ad
1 parent ecfa93b commit acbd3f1

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

third-party/folly/src/folly/MicroLock.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424
#include <folly/Optional.h>
2525
#include <folly/Portability.h>
26+
#include <folly/Utility.h>
2627
#include <folly/synchronization/AtomicNotification.h>
2728
#include <folly/synchronization/AtomicRef.h>
2829

@@ -289,11 +290,11 @@ uint8_t MicroLockBase<MaxSpins, MaxYields>::lockAndLoad() noexcept {
289290
if ((oldWord & heldBit()) == 0 &&
290291
atomic_ref(lock_).compare_exchange_weak(
291292
oldWord,
292-
oldWord | heldBit(),
293+
to_narrow(oldWord | heldBit()),
293294
std::memory_order_acquire,
294295
std::memory_order_relaxed)) {
295296
// Fast uncontended case: memory_order_acquire above is our barrier
296-
return decodeDataFromWord(oldWord | heldBit());
297+
return decodeDataFromWord(to_narrow(oldWord | heldBit()));
297298
} else {
298299
// lockSlowPath doesn't call waitBit(); it just shifts the input bit. Make
299300
// sure its shifting produces the same result a call to waitBit would.

0 commit comments

Comments
 (0)