Boolean shifts & scans

Shifts

One and previous is one

(&)prior x
One and previous is zero
(>)prior x
Zero and previous is one
(<)prior x
Zero and previous is zero
not (|)prior x
Previous bit is different
differ x
Previous bit is same
not differ x

Scans

Ones until first zero from left

k)&amp;\x
mins x
Ones after first zero from left
k)~&amp;\x
not mins x
Zeros until first one from left
k)|\x
maxs x
Zeros after first one from left
k)~|\x
not maxs x
Ones until first zero from right
k)|&amp;\|x
reverse mins reverse x
Ones after first zero from right
k)|~&amp;\|x
reverse not mins reverse x
Zeros until first one from right
k)||\|x
reverse maxs reverse x
Zeros after first one from right
k)|~|\|x
reverse not maxs reverse x
Boolean finite-state machine (switch state on 0)
k)(=)\x
(=)scan x
Ones and ones between ones
k)x|(~=)\x
x or(<>)scan x
Ones between ones
k)(~x)&amp;(~=)\x
(not x)and(<>)scan x