simplify 16-bit anynePositive

This commit is contained in:
dzaima 2022-11-25 18:57:03 +02:00
parent 5f85305f43
commit 15f6dd5d48

View File

@ -21,6 +21,7 @@ def anyneBit{x:T, y:T, M} = ~M{x^y, 'all bits zeroes'}
def anynePositive{x:T, y:T, M & M{0}==0} = anyne{x, y, M} def anynePositive{x:T, y:T, M & M{0}==0} = anyne{x, y, M}
def anynePositive{x:T, y:T, M & M{0}==1 & isvec{T }} = (promote{u32,~getmask{ x==y }} << (32-M{'count'} )) != 0 def anynePositive{x:T, y:T, M & M{0}==1 & isvec{T }} = (promote{u32,~getmask{ x==y }} << (32-M{'count'} )) != 0
def anynePositive{x:T, y:T, M & M{0}==1 & w256{T,16}} = (promote{u32,~getmask{[32]u8~~(x==y)}} << (32-M{'count'}*2)) != 0
def maskNone{x} = x def maskNone{x} = x
def maskNone{x, mode=='all bits zeroes'} = andIsZero{x, x} def maskNone{x, mode=='all bits zeroes'} = andIsZero{x, x}