@@ -592,30 +592,30 @@ _dq_state_has_side_suspend_cnt(uint64_t dq_state)
592
592
}
593
593
594
594
DISPATCH_ALWAYS_INLINE
595
- static inline uint32_t
595
+ static inline int32_t
596
596
_dq_state_extract_width_bits (uint64_t dq_state )
597
597
{
598
598
dq_state &= DISPATCH_QUEUE_WIDTH_MASK ;
599
- return (uint32_t )(dq_state >> DISPATCH_QUEUE_WIDTH_SHIFT );
599
+ return (int32_t )(dq_state >> DISPATCH_QUEUE_WIDTH_SHIFT );
600
600
}
601
601
602
602
DISPATCH_ALWAYS_INLINE
603
- static inline uint32_t
603
+ static inline int32_t
604
604
_dq_state_available_width (uint64_t dq_state )
605
605
{
606
- uint32_t full = DISPATCH_QUEUE_WIDTH_FULL ;
606
+ int32_t full = DISPATCH_QUEUE_WIDTH_FULL ;
607
607
if (likely (!(dq_state & DISPATCH_QUEUE_WIDTH_FULL_BIT ))) {
608
608
return full - _dq_state_extract_width_bits (dq_state );
609
609
}
610
610
return 0 ;
611
611
}
612
612
613
613
DISPATCH_ALWAYS_INLINE
614
- static inline uint32_t
614
+ static inline int32_t
615
615
_dq_state_used_width (uint64_t dq_state , uint16_t dq_width )
616
616
{
617
- uint32_t full = DISPATCH_QUEUE_WIDTH_FULL ;
618
- uint32_t width = _dq_state_extract_width_bits (dq_state );
617
+ int32_t full = DISPATCH_QUEUE_WIDTH_FULL ;
618
+ int32_t width = _dq_state_extract_width_bits (dq_state );
619
619
620
620
if (dq_state & DISPATCH_QUEUE_PENDING_BARRIER ) {
621
621
// DISPATCH_QUEUE_PENDING_BARRIER means (dq_width - 1) of the used width
@@ -1030,21 +1030,21 @@ _dispatch_queue_try_reserve_sync_width(dispatch_queue_t dq)
1030
1030
* possibly 0
1031
1031
*/
1032
1032
DISPATCH_ALWAYS_INLINE DISPATCH_WARN_RESULT
1033
- static inline uint32_t
1034
- _dispatch_queue_try_reserve_apply_width (dispatch_queue_t dq , uint32_t da_width )
1033
+ static inline int32_t
1034
+ _dispatch_queue_try_reserve_apply_width (dispatch_queue_t dq , int32_t da_width )
1035
1035
{
1036
1036
uint64_t old_state , new_state ;
1037
- uint32_t width ;
1037
+ int32_t width ;
1038
1038
1039
1039
(void )os_atomic_rmw_loop2o (dq , dq_state , old_state , new_state , relaxed , {
1040
- width = _dq_state_available_width (old_state );
1040
+ width = ( int32_t ) _dq_state_available_width (old_state );
1041
1041
if (unlikely (!width )) {
1042
1042
os_atomic_rmw_loop_give_up (return 0 );
1043
1043
}
1044
1044
if (width > da_width ) {
1045
1045
width = da_width ;
1046
1046
}
1047
- new_state = old_state + width * DISPATCH_QUEUE_WIDTH_INTERVAL ;
1047
+ new_state = old_state + ( uint64_t ) width * DISPATCH_QUEUE_WIDTH_INTERVAL ;
1048
1048
});
1049
1049
return width ;
1050
1050
}
@@ -1055,10 +1055,10 @@ _dispatch_queue_try_reserve_apply_width(dispatch_queue_t dq, uint32_t da_width)
1055
1055
*/
1056
1056
DISPATCH_ALWAYS_INLINE
1057
1057
static inline void
1058
- _dispatch_queue_relinquish_width (dispatch_queue_t dq , uint32_t da_width )
1058
+ _dispatch_queue_relinquish_width (dispatch_queue_t dq , int32_t da_width )
1059
1059
{
1060
1060
(void )os_atomic_sub2o (dq , dq_state ,
1061
- da_width * DISPATCH_QUEUE_WIDTH_INTERVAL , relaxed );
1061
+ ( uint64_t ) da_width * DISPATCH_QUEUE_WIDTH_INTERVAL , relaxed );
1062
1062
}
1063
1063
1064
1064
/* Used by target-queue recursing code
@@ -1474,7 +1474,7 @@ _dispatch_queue_push_update_head(dispatch_queue_t dq,
1474
1474
DISPATCH_ALWAYS_INLINE
1475
1475
static inline void
1476
1476
_dispatch_root_queue_push_inline (dispatch_queue_t dq , dispatch_object_t _head ,
1477
- dispatch_object_t _tail , unsigned int n )
1477
+ dispatch_object_t _tail , int n )
1478
1478
{
1479
1479
struct dispatch_object_s * head = _head ._do , * tail = _tail ._do ;
1480
1480
if (unlikely (_dispatch_queue_push_update_tail_list (dq , head , tail ))) {
0 commit comments