Fix undefined behavior.

BUG=skia:4050

Review URL: https://codereview.chromium.org/1232003008
This commit is contained in:
herb 2015-07-15 07:40:37 -07:00 committed by Commit bot
parent dc77b35918
commit fd9a6a227b

View File

@ -11,7 +11,6 @@
#include "SkSemaphore.h"
#include "SkTypes.h"
#if defined(THREAD_SANITIZER)
/* Report that a lock has been created at address "lock". */
@ -168,7 +167,7 @@ void SkSharedMutex::releaseShared() {
ANNOTATE_RWLOCK_RELEASED(this, 0);
// Decrement the shared count.
int32_t oldQueueCounts = fQueueCounts.fetch_add(-1 << kSharedOffset,
int32_t oldQueueCounts = fQueueCounts.fetch_add(~0U << kSharedOffset,
sk_memory_order_release);
// If shared count is going to zero (because the old count == 1) and there are exclusive