diff --git a/src/singeli/src/bitops.singeli b/src/singeli/src/bitops.singeli index cc558df4..1824dd4a 100644 --- a/src/singeli/src/bitops.singeli +++ b/src/singeli/src/bitops.singeli @@ -47,3 +47,16 @@ def b_setBatch{sz, x:*u64, n:(Size), v & sz== 8} = store{*u8 ~~ x, n, cast_i{u8 def b_setBatch{sz, x:*u64, n:(Size), v & sz==16} = store{*u16 ~~ x, n, cast_i{u16,v}} def b_setBatch{sz, x:*u64, n:(Size), v & sz==32} = store{*u32 ~~ x, n, cast_i{u32,v}} def b_setBatch{sz, x:*u64, n:(Size), v & sz==64} = store{ x, n, cast_i{u64,v}} + +def spreadBits{T==[32]u8, a:u32} = { + def idxs = iota{32} + b:= broadcast{[8]u32, a} + c:= [32]u8~~b + d:= sel{[16]u8, c, make{[32]i8, idxs>>3 + bit{4, idxs}}} + e:= make{[32]u8, 1<>3 + bit{4, idxs}}} - e:= make{[32]u8, 1< { + cw:= loadBatch{*TU~~w, i, TV} + cx:= loadBatchBit{TV, *u64~~x, i} + storeBatch{*TU~~r, i, cw&cx, M} + }} } else { def bulk = vw / max{max{width{W}, width{X}}, width{R}} def overflow = tern{mode==1, {i}=>return{i}, tern{mode==2, {i}=>return{1}, 0}} diff --git a/src/singeli/src/genArithTables.bqn b/src/singeli/src/genArithTables.bqn index f5c020f2..74a63e89 100644 --- a/src/singeli/src/genArithTables.bqn +++ b/src/singeli/src/genArithTables.bqn @@ -213,8 +213,8 @@ Make ← {𝕊ns: } Make¨ { repr‿cbqn: commutative⇐1 ⋄ repr‿cbqn⇐ ⋄ si⇐"__mul" ⋄ id⇐"mul" - aa_a ⇐ bitand∾c_numDiag # ∾⟨u‿bit‿i8‿i8, u‿bit‿i16‿i16, u‿bit‿i32‿i32, u‿bit‿f64‿f64⟩ - aa_b ⇐ w_numDiag # TODO readd ↑ + aa_a ⇐ bitand∾c_numDiag∾⟨u‿bit‿i8‿i8, u‿bit‿i16‿i16, u‿bit‿i32‿i32⟩ # no u‿bit‿f64‿f64 because 0×∞ etc + aa_b ⇐ w_numDiag sa⇐⟨"iii"⟩ ⋄ overflowEq⇐1 }¨ ⟨"×"‿"mul", "∧"‿"and"⟩ Make {