Changeset 87194 in vbox for trunk/src/VBox/Runtime/common
- Timestamp:
- Jan 7, 2021 9:02:43 PM (4 years ago)
- Location:
- trunk/src/VBox/Runtime/common/asm
- Files:
-
- 2 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/asm/ASMBitNextClear-generic.cpp
r87193 r87194 46 46 * Inspect the 32-bit word containing the unaligned bit. 47 47 */ 48 uint32_t 48 uint32_t u32 = ~RT_LE2H_U32(pau32Bitmap[iBitPrev / 32]) >> iBit; 49 49 if (u32) 50 50 return iBitPrev + ASMBitFirstSetU32(u32) - 1; -
trunk/src/VBox/Runtime/common/asm/ASMBitNextSet-generic.cpp
r87193 r87194 1 1 /* $Id$ */ 2 2 /** @file 3 * IPRT - ASMBitNext Clear- generic C implementation.3 * IPRT - ASMBitNextSet - generic C implementation. 4 4 */ 5 5 … … 35 35 36 36 37 DECLASM(int) ASMBitNext Clear(const volatile void RT_FAR *pvBitmap, uint32_t cBits, uint32_t iBitPrev) RT_NOTHROW_DEF37 DECLASM(int) ASMBitNextSet(const volatile void RT_FAR *pvBitmap, uint32_t cBits, uint32_t iBitPrev) RT_NOTHROW_DEF 38 38 { 39 39 const volatile uint32_t RT_FAR *pau32Bitmap = (const volatile uint32_t RT_FAR *)pvBitmap; … … 46 46 * Inspect the 32-bit word containing the unaligned bit. 47 47 */ 48 uint32_t u32 = ~RT_LE2H_U32(pau32Bitmap[iBitPrev / 32]) >> iBit;48 uint32_t u32 = RT_LE2H_U32(pau32Bitmap[iBitPrev / 32]) >> iBit; 49 49 if (u32) 50 50 return iBitPrev + ASMBitFirstSetU32(u32) - 1; … … 60 60 61 61 /* 62 * 32-bit aligned search, let ASMBitFirst Cleardo the dirty work.62 * 32-bit aligned search, let ASMBitFirstSet do the dirty work. 63 63 */ 64 iBit = ASMBitFirst Clear(&pau32Bitmap[iBitPrev / 32], cBits - iBitPrev);64 iBit = ASMBitFirstSet(&pau32Bitmap[iBitPrev / 32], cBits - iBitPrev); 65 65 if (iBit >= 0) 66 66 iBit += iBitPrev; -
trunk/src/VBox/Runtime/common/asm/asm-fake.cpp
r87193 r87194 297 297 } 298 298 299 RTDECL(int) ASMBitNextSet(const volatile void *pvBitmap, uint32_t cBits, uint32_t iBitPrev)300 {301 const volatile uint8_t *pau8Bitmap = (const volatile uint8_t *)pvBitmap;302 int iBit = ++iBitPrev & 7;303 if (iBit)304 {305 /*306 * Inspect the byte containing the unaligned bit.307 */308 uint8_t u8 = pau8Bitmap[iBitPrev / 8] >> iBit;309 if (u8)310 {311 iBit = 0;312 while (!(u8 & 1))313 {314 u8 >>= 1;315 iBit++;316 }317 return iBitPrev + iBit;318 }319 320 /*321 * Skip ahead and see if there is anything left to search.322 */323 iBitPrev |= 7;324 iBitPrev++;325 if (cBits <= iBitPrev)326 return -1;327 }328 329 /*330 * Byte search, let ASMBitFirstSet do the dirty work.331 */332 iBit = ASMBitFirstSet(&pau8Bitmap[iBitPrev / 8], cBits - iBitPrev);333 if (iBit >= 0)334 iBit += iBitPrev;335 return iBit;336 }337 338 299 RTDECL(unsigned) ASMBitFirstSetU32(uint32_t u32) 339 300 {
Note:
See TracChangeset
for help on using the changeset viewer.