remove redundant parentheses in Singeli destructuring
This commit is contained in:
parent
59515acc90
commit
66a8529d88
@ -249,7 +249,7 @@ def truncBits{n, v if n==64} = cast_i{u64, v}
|
||||
|
||||
# base-2 log of a constant power of two
|
||||
def lb{n if knum{n} and (n>>1<<1) == n and n>0} = lb{n>>1}+1
|
||||
def lb{(1)} = 0
|
||||
def lb{1} = 0
|
||||
|
||||
def zlow{n,x} = (x >> n) << n # zero out n least significant bits
|
||||
def tail{n,x} = x & ((1<<n) - 1) # get the n least significant bits
|
||||
|
||||
@ -108,11 +108,11 @@ def runner{u, R, F} = {
|
||||
|
||||
# homAny, topAny already give masked vals; anyne doesn't, and ~andAllZero assumes no masking
|
||||
def runChecks_any{F, vals} = { F{tree_fold{|, each{select{.,1}, vals}}} }
|
||||
def runChecks{('homAny'), vals, M} = runChecks_any{homAny, vals}
|
||||
def runChecks{('topAny'), vals, M} = runChecks_any{topAny, vals}
|
||||
def runChecks{('none'), vals, M} = 0
|
||||
def runChecks{('~andAllZero'), vals, M if ~M{0}} = ~tree_fold{&, each{andAllZero, ...slice{flip{vals}, 1}}}
|
||||
def runChecks{('anyne'), vals, M} = {
|
||||
def runChecks{'homAny', vals, M} = runChecks_any{homAny, vals}
|
||||
def runChecks{'topAny', vals, M} = runChecks_any{topAny, vals}
|
||||
def runChecks{'none', vals, M} = 0
|
||||
def runChecks{'~andAllZero', vals, M if ~M{0}} = ~tree_fold{&, each{andAllZero, ...slice{flip{vals}, 1}}}
|
||||
def runChecks{'anyne', vals, M} = {
|
||||
def i{vals} = {
|
||||
def {_,xs,ys} = flip{vals}
|
||||
assert{M{0} == 0}
|
||||
|
||||
@ -53,7 +53,7 @@ def hash_alloc{logsz, msz, ext, Ts, v0s, has_radix, ordered} = {
|
||||
def pe{{..._, p}} = p+sze # Next unallocated space given pointers so far
|
||||
def pl{{...R, T}} = { def ps=pl{R}; tup{...ps, *T~~pe{ps}+szo} }
|
||||
ptrs := pl{Ts}
|
||||
def memset{_, ('any'), _} = {} # Indicates initialization not needed
|
||||
def memset{_, 'any', _} = {} # Indicates initialization not needed
|
||||
each{memset{., ., sze}, ptrs, v0s}
|
||||
|
||||
def hash_resize{cc, m} = {
|
||||
|
||||
@ -28,16 +28,16 @@ def anynePositive{x:T, y:T, M if M{0}==1 and isvec{T}} = {
|
||||
}
|
||||
|
||||
def maskNone{x} = x
|
||||
def maskNone{x, ('all bits zeroes')} = andAllZero{x, x}
|
||||
def maskNone{x, 'all bits zeroes'} = andAllZero{x, x}
|
||||
def maskAfter{n} = {
|
||||
def mask{x:X, ('all bits zeroes')} = andAllZero{x, X~~maskOfBit{X,n}}
|
||||
def mask{X, ('to sign bits')} = maskOf{X,n}
|
||||
def mask{X, ('to homogeneous bits')} = maskOf{X,n}
|
||||
def mask{('count')} = n
|
||||
def mask{x:X, 'all bits zeroes'} = andAllZero{x, X~~maskOfBit{X,n}}
|
||||
def mask{X, 'to sign bits'} = maskOf{X,n}
|
||||
def mask{X, 'to homogeneous bits'} = maskOf{X,n}
|
||||
def mask{'count'} = n
|
||||
def mask{{x}} = tup{mask{x}}
|
||||
def mask{x:X if isvec{X}} = x & (X~~maskOf{X,n})
|
||||
def mask{x:X if anyInt{x}} = x & ((1<<n) - 1)
|
||||
def mask{(0)} = 1
|
||||
def mask{0} = 1
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -521,7 +521,7 @@ fn hashtab{T, name}(rpi:*rty{name}, iv:*void, mi:usz, fv:*void, ni:usz, links:it
|
||||
}
|
||||
|
||||
match (prim, ...vals, ...links) {
|
||||
{('∊')} => {
|
||||
{'∊'} => {
|
||||
has_maxh:u1 = 0
|
||||
uniq:usz = 0 # Uniques inserted
|
||||
def dup = makelabel{}
|
||||
@ -540,7 +540,7 @@ fn hashtab{T, name}(rpi:*rty{name}, iv:*void, mi:usz, fv:*void, ni:usz, links:it
|
||||
lookup_all{{found, j} => promote{i8, swap ^ (found & (j<end))}}
|
||||
}
|
||||
|
||||
{('⊐'), inds} => if (not swap) {
|
||||
{'⊐', inds} => if (not swap) {
|
||||
has_maxh:u1 = 0
|
||||
ind_maxh:u32 = 0
|
||||
def dup = makelabel{}
|
||||
@ -586,7 +586,7 @@ fn hashtab{T, name}(rpi:*rty{name}, iv:*void, mi:usz, fv:*void, ni:usz, links:it
|
||||
@for (r in rp over i to n) r = load{rp, min{i, u32~~r+n}}
|
||||
}
|
||||
|
||||
{('⊒'), inds, link} => {
|
||||
{'⊒', inds, link} => {
|
||||
store{link,0,0}
|
||||
store{inds, maxh>>sh + cast_i{T,ext}, 0}
|
||||
def dup = makelabel{}
|
||||
|
||||
@ -31,8 +31,8 @@ fn selfhashtab{T, name}(rpi:*rty{name}, xp:*T, n:usz) = {
|
||||
}
|
||||
|
||||
def {output, write_res} = match (prim) {
|
||||
{('∊')} => tup{{b}=>b, {j,h,k,x0} => { hash<-{j}h; promote{i8,k!=h} }}
|
||||
{('⊒')} => {
|
||||
{'∊'} => tup{{b}=>b, {j,h,k,x0} => { hash<-{j}h; promote{i8,k!=h} }}
|
||||
{'⊒'} => {
|
||||
ctr0:u32 = 1; def {val} = vals
|
||||
def res{j,h,k,x0} = {
|
||||
e0:=promote{u32,h==x0}; vj:=val->j; c0:=ctr0
|
||||
@ -41,7 +41,7 @@ fn selfhashtab{T, name}(rpi:*rty{name}, xp:*T, n:usz) = {
|
||||
}
|
||||
tup{{b}=>b, res}
|
||||
}
|
||||
{('⊐')} => {
|
||||
{'⊐'} => {
|
||||
ctr:u32 = 1; def {val} = vals
|
||||
def res{j,h,k,x0} = {
|
||||
if (k!=h) { val<-{j}ctr; ++ctr; hash<-{j}h }
|
||||
|
||||
Loading…
Reference in New Issue
Block a user