- Timestamp:
- May 19, 2015 11:44:11 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/cpuset.h
r53327 r55948 111 111 { 112 112 int iCpu = RTMpCpuIdToSetIndex(idCpu); 113 if (RT_UNLIKELY(iCpu < 0)) 114 return -1; 115 ASMAtomicBitSet(pSet, iCpu); 116 return 0; 113 if (RT_LIKELY(iCpu >= 0)) 114 { 115 ASMAtomicBitSet(pSet, iCpu); 116 return 0; 117 } 118 return -1; 117 119 } 118 120 … … 128 130 DECLINLINE(int) RTCpuSetAddByIndex(PRTCPUSET pSet, int iCpu) 129 131 { 130 if (RT_UNLIKELY((unsigned)iCpu >= RTCPUSET_MAX_CPUS)) 131 return -1; 132 ASMAtomicBitSet(pSet, iCpu); 133 return 0; 132 if (RT_LIKELY((unsigned)iCpu < RTCPUSET_MAX_CPUS)) 133 { 134 ASMAtomicBitSet(pSet, iCpu); 135 return 0; 136 } 137 return -1; 134 138 } 135 139 … … 146 150 { 147 151 int iCpu = RTMpCpuIdToSetIndex(idCpu); 148 if (RT_UNLIKELY(iCpu < 0)) 149 return -1; 150 ASMAtomicBitClear(pSet, iCpu); 151 return 0; 152 if (RT_LIKELY(iCpu >= 0)) 153 { 154 ASMAtomicBitClear(pSet, iCpu); 155 return 0; 156 } 157 return -1; 152 158 } 153 159 … … 163 169 DECLINLINE(int) RTCpuSetDelByIndex(PRTCPUSET pSet, int iCpu) 164 170 { 165 if (RT_UNLIKELY((unsigned)iCpu >= RTCPUSET_MAX_CPUS)) 166 return -1; 167 ASMAtomicBitClear(pSet, iCpu); 168 return 0; 171 if (RT_LIKELY((unsigned)iCpu < RTCPUSET_MAX_CPUS)) 172 { 173 ASMAtomicBitClear(pSet, iCpu); 174 return 0; 175 } 176 return -1; 169 177 } 170 178 … … 181 189 { 182 190 int iCpu = RTMpCpuIdToSetIndex(idCpu); 183 if (RT_ UNLIKELY(iCpu <0))184 return false;185 return ASMBitTest((volatile void *)pSet, iCpu);191 if (RT_LIKELY(iCpu >= 0)) 192 return ASMBitTest((volatile void *)pSet, iCpu); 193 return false; 186 194 } 187 195 … … 197 205 DECLINLINE(bool) RTCpuSetIsMemberByIndex(PCRTCPUSET pSet, int iCpu) 198 206 { 199 if (RT_ UNLIKELY((unsigned)iCpu >=RTCPUSET_MAX_CPUS))200 return false;201 return ASMBitTest((volatile void *)pSet, iCpu);207 if (RT_LIKELY((unsigned)iCpu < RTCPUSET_MAX_CPUS)) 208 return ASMBitTest((volatile void *)pSet, iCpu); 209 return false; 202 210 } 203 211
Note:
See TracChangeset
for help on using the changeset viewer.