]> git.saurik.com Git - apple/xnu.git/blobdiff - bsd/pthread/priority_private.h
xnu-6153.81.5.tar.gz
[apple/xnu.git] / bsd / pthread / priority_private.h
index b73c0ad95bf4a6a57433a2ef7fb0273d02196074..dbfff7e5452f652eff34c45263e9566570a4e10e 100644 (file)
@@ -179,14 +179,21 @@ _pthread_default_priority(unsigned long flags)
        return _pthread_priority_make_from_thread_qos(THREAD_QOS_LEGACY, 0, 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)) {
 __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;
 }
        }
        return THREAD_QOS_UNSPECIFIED;
 }