x/~x &/|/^ (x / -x / x+1 / x-1) so are being superceded.
needs some work though
+```
+def bmask(mode, RA, RB=None, zero=False):
+ mask = [1] * XLEN
+ mask = RB if RB is not None else 0xffffffffffffffff
+ ra <- RA & mask
+ if mode[0] then a1 <- ra else a1 <-~ra
+ mode2 = (mode >> 1) & 0b11
+ if mode2 = 0 then a2 <- -ra
+ if mode2 = 1 then a2 <- ra-1
+ if mode2 = 2 then a2 <- ra+1
+ if mode2 = 3 then a2 <- ~(ra+1)
+ a1 <- a1 & mask
+ a2 <- a2 & mask
+ mode3 <- mode[3:4]
+ if mode3 = 0 then result <- a1 | a2
+ if mode3 = 1 then result <- a1 & a2
+ if mode3 = 2 result <- a1 ^ a2
+ if mode3 = 3 result <- UNDEFINED
+ result <- result & mask
+ if L = 1 then
+ result <- result | (RA & ~mask)
+ RT <- result
+
+SBF = 0b01010 # set before first
+SOF = 0b01001 # set only first
+SIF = 0b10000 # set including first 10011 also works no idea why yet
+```
+
+
## OBSOLETE sbfm
sbfm RT, RA, RB!=0