35.3.9.8. INTEGER BITS AND BITSTRING ON X86
(Bit Scan Forward) ===============
BSF r16,r/m16 0F BC
BSF r32,r/m32 0F BC
if r/m = 0
{
ZF <- 1
r <- Undefined
} else
{
temp <- 0
ZF <- 0
while bite[r/m,temp] = 0
DO
temp <- temp + 1
r <- temp
OD
}
(Bit Scan Reverse) ===============
BSF r16,r/m16 0F BD
BSF r32,r/m32 0F BD
if r/m = 0
{
ZF <- 1
r <- Undefined
} else
{
temp <- OperandSize - 1
ZF <- 0
while bite[r/m,temp] = 0
DO
temp <- temp - 1
r <- temp
OD
}
(Bit Test) =========================
BT r/m16,r16 0F A3
BT r/m32,r32 0F A3
BT r/m16,i8 0F BA /4 ib
BT r/m32,i8 0F BA /4 ib
CF <- BIT[r/m,r/i]
(Bit Test and Complement) ==============
BTC r/m16,r16 0F BB
BTC r/m32,r32 0F BB
BTC r/m16,i8 0F BA /7 ib
BTC r/m32,i8 0F BA /7 ib
CF <- BIT[r/m,r/i]
BIT[r/m,r/i] <- NOT BIT[r/m,r/i]
(Bit Test and Reset) ==============
BTR r/m16,r16 0F B3
BTR r/m32,r32 0F B3
BTR r/m16,i8 0F BA /6 ib
BTR r/m32,i8 0F BA /6 ib
CF <- BIT[r/m,r/i]
BIT[r/m,r/i] <- 0
(Bit Test and Set) ==============
BTS r/m16,r16 0F AB
BTS r/m32,r32 0F AB
BTS r/m16,i8 0F BA /5 ib
BTS r/m32,i8 0F BA /5 ib
CF <- BIT[r/m,r/i]
BIT[r/m,r/i] <- 1
Note: Use SHLD,SHRD for Extract Bitstrings
Index Prev Next