Clean up __builtin_expect usage.
Also remove some dead code; our malloc debugging doesn't use this
any more.
Change-Id: Id69cf182371f5f37d40b5bbd08f2744ade286e66
diff --git a/libc/bionic/pthread-rwlocks.c b/libc/bionic/pthread-rwlocks.c
index deee577..59e2248 100644
--- a/libc/bionic/pthread-rwlocks.c
+++ b/libc/bionic/pthread-rwlocks.c
@@ -53,9 +53,6 @@
*
*/
-#define __likely(cond) __builtin_expect(!!(cond), 1)
-#define __unlikely(cond) __builtin_expect(!!(cond), 0)
-
#define RWLOCKATTR_DEFAULT 0
#define RWLOCKATTR_SHARED_MASK 0x0010
@@ -212,7 +209,7 @@
return EINVAL;
pthread_mutex_lock(&rwlock->lock);
- if (__unlikely(!read_precondition(rwlock, __get_thread()->tid)))
+ if (__predict_false(!read_precondition(rwlock, __get_thread()->tid)))
ret = EBUSY;
else
rwlock->numLocks ++;
@@ -230,7 +227,7 @@
pthread_mutex_lock(&rwlock->lock);
int tid = __get_thread()->tid;
- if (__unlikely(!read_precondition(rwlock, tid))) {
+ if (__predict_false(!read_precondition(rwlock, tid))) {
rwlock->pendingReaders += 1;
do {
ret = pthread_cond_timedwait(&rwlock->cond, &rwlock->lock, abs_timeout);
@@ -260,7 +257,7 @@
pthread_mutex_lock(&rwlock->lock);
int tid = __get_thread()->tid;
- if (__unlikely(!write_precondition(rwlock, tid))) {
+ if (__predict_false(!write_precondition(rwlock, tid))) {
ret = EBUSY;
} else {
rwlock->numLocks ++;
@@ -279,7 +276,7 @@
pthread_mutex_lock(&rwlock->lock);
int tid = __get_thread()->tid;
- if (__unlikely(!write_precondition(rwlock, tid))) {
+ if (__predict_false(!write_precondition(rwlock, tid))) {
/* If we can't read yet, wait until the rwlock is unlocked
* and try again. Increment pendingReaders to get the
* cond broadcast when that happens.