X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/0a7de7458d150b5d4dffc935ba399be265ef0a1a..c6bf4f310a33a9262d455ea4d3f0630b1255e3fe:/bsd/pthread/priority_private.h diff --git a/bsd/pthread/priority_private.h b/bsd/pthread/priority_private.h index b73c0ad95..dbfff7e54 100644 --- a/bsd/pthread/priority_private.h +++ b/bsd/pthread/priority_private.h @@ -179,14 +179,21 @@ _pthread_default_priority(unsigned long flags) return _pthread_priority_make_from_thread_qos(THREAD_QOS_LEGACY, 0, flags); } +__attribute__((always_inline, const)) +static inline thread_qos_t +_pthread_priority_thread_qos_fast(pthread_priority_t pp) +{ + pp &= _PTHREAD_PRIORITY_QOS_CLASS_MASK; + pp >>= _PTHREAD_PRIORITY_QOS_CLASS_SHIFT; + return (thread_qos_t)__builtin_ffs((int)pp); +} + __attribute__((always_inline, const)) static inline thread_qos_t _pthread_priority_thread_qos(pthread_priority_t pp) { if (_pthread_priority_has_qos(pp)) { - pp &= _PTHREAD_PRIORITY_QOS_CLASS_MASK; - pp >>= _PTHREAD_PRIORITY_QOS_CLASS_SHIFT; - return (thread_qos_t)__builtin_ffs((int)pp); + return _pthread_priority_thread_qos_fast(pp); } return THREAD_QOS_UNSPECIFIED; }