Changeset 58758 in vbox
- Timestamp:
- Nov 19, 2015 1:00:30 AM (9 years ago)
- Location:
- trunk/src/VBox/Runtime
- Files:
-
- 1 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/Makefile.kmk
r58757 r58758 182 182 common/asm/ASMBitFirstClear.asm \ 183 183 common/asm/ASMBitFirstSet.asm \ 184 common/asm/ASMBitNextClear.asm \ 184 185 common/asm/ASMBitNextSet.asm \ 185 186 common/asm/ASMMultU32ByU32DivByU32.asm \ -
trunk/src/VBox/Runtime/common/asm/ASMBitNextClear.asm
r58757 r58758 1 1 ; $Id$ 2 2 ;; @file 3 ; IPRT - ASMBitNext Set().3 ; IPRT - ASMBitNextClear(). 4 4 ; 5 5 … … 34 34 35 35 ;; 36 ; Finds the first setbit in a bitmap.36 ; Finds the first clear bit in a bitmap. 37 37 ; 38 38 ; @returns (32/64:eax, 16:ax+dx) Index of the first zero bit. 39 ; @returns (32/64:eax, 16:ax+dx) -1 if no setbit was found.39 ; @returns (32/64:eax, 16:ax+dx) -1 if no clear bit was found. 40 40 ; @param msc:rcx gcc:rdi pvBitmap Pointer to the bitmap. 41 41 ; @param msc:edx gcc:rsi cBits The number of bits in the bitmap. Multiple of 32. … … 45 45 ; it started out with the ASMBit* API, so that's why we still have it. 46 46 ; 47 BEGINPROC_EXPORTED ASMBitNext Set47 BEGINPROC_EXPORTED ASMBitNextClear 48 48 %if ARCH_BITS == 16 49 49 push bp … … 86 86 87 87 %if ARCH_BITS == 16 88 mov edx, [es:di] ; edx = current dword88 mov edx, [es:di] 89 89 %else 90 mov edx, [xDI] ; edx = current dword90 mov edx, [xDI] 91 91 %endif 92 not edx ; edx = inverted current dword 92 93 shr edx, cl ; Shift out bits that we have searched. 93 94 jz .next_dword ; If zero, nothing to find. Go rep scasd. 94 95 shl edx, cl ; Shift it back so bsf will return the right index. 95 96 96 bsf edx, edx ; edx=index of first setbit97 bsf edx, edx ; edx=index of first clear bit 97 98 98 99 shl eax, 3 ; Turn eax back into a bit offset of the current dword. … … 139 140 140 141 ; Do the scanning. 141 xor eax, eax142 mov eax, 0ffffffffh 142 143 repe scasd 143 144 je .return_failure … … 147 148 %if ARCH_BITS == 16 148 149 movzx edi, di 149 moveax, [es:xDI]150 xor eax, [es:xDI] 150 151 %else 151 moveax, [xDI]152 xor eax, [xDI] 152 153 %endif 153 154 bsf eax, eax … … 170 171 mov eax, 0ffffffffh 171 172 jmp .return 172 ENDPROC ASMBitNext Set173 ENDPROC ASMBitNextClear 173 174 174 175
Note:
See TracChangeset
for help on using the changeset viewer.