use specified-output-type fold_addw

This commit is contained in:
dzaima 2025-04-24 00:05:38 +03:00
parent 3d52d14101
commit 0ec37303ea
2 changed files with 3 additions and 3 deletions

View File

@ -119,7 +119,7 @@ def sum_accumulator{DE, unr, VT=[_]SE if int_els{DE,SE} and DE>SE and hasarch{'A
def me{...} = acc def me{...} = acc
def into_scal{vs} = { def into_scal{vs} = {
def ps = each{if (exact) vfold{+,.} else fold_addw, vs} def ps = each{fold_addw{DE,.}, vs}
acc_scal+= tree_fold{+, each{promote{A,.}, ps}} acc_scal+= tree_fold{+, each{promote{A,.}, ps}}
} }
def me{'from_unr'} = into_scal{slice{acc_tup, 1}} def me{'from_unr'} = into_scal{slice{acc_tup, 1}}

View File

@ -49,7 +49,7 @@ fn count{T if T<=i16}(tab:*u16, ov:*u16, xp:*void, n:u64, min_allowed:T) : T = {
if (mt > mx) mx = mt if (mt > mx) mx = mt
# Fast cases # Fast cases
dt := promote{u64, fold_addw{dc}} dt := fold_addw{u64, dc}
nc := TU~~(mt - jt) # Number of counts to perform: last is implicit nc := TU~~(mt - jt) # Number of counts to perform: last is implicit
if (dt < b * (vec/2) and (b + dt)*4 < b * promote{u64,nc}) { if (dt < b * (vec/2) and (b + dt)*4 < b * promote{u64,nc}) {
r0 = count_with_runs{x, tab, r} r0 = count_with_runs{x, tab, r}
@ -103,7 +103,7 @@ def count_by_sum{T, V, U, xv, b, tab, r0, j0, m} = {
e := each{{j}=>V**j, j} e := each{{j}=>V**j, j}
@for (xv over b) each{{c,e} => c -= xv == e, c, e} @for (xv over b) each{{c,e} => c -= xv == e, c, e}
def add_sum{c, j} = { def add_sum{c, j} = {
s := promote{usz, fold_addw{c}} s := fold_addw{usz, c}
total -= s; inc{tab, j, s} total -= s; inc{tab, j, s}
} }
each{add_sum, c, j} each{add_sum, c, j}