From: Chris Duncan Date: Mon, 26 Oct 2026 18:01:23 +0000 (-0700) Subject: Simplify lanewise doubling. X-Git-Url: https://git.codecow.com/?a=commitdiff_plain;h=84b82c7074b990ad72bb1e198b6d4cd7c5bce287;p=nano25519.git Simplify lanewise doubling. --- diff --git a/src/assembly/ed25519/fep.ts b/src/assembly/ed25519/fep.ts index b249dfc..41c3945 100644 --- a/src/assembly/ed25519/fep.ts +++ b/src/assembly/ed25519/fep.ts @@ -314,11 +314,12 @@ export function fep_dbl_lane (h: FieldElementPair, f: FieldElementPair): void { const f3 = v128.load(changetype(f), 3 << 4) const f4 = v128.load(changetype(f), 4 << 4) - const h0 = v128.bitselect(f0, v128.add(f0, f0), i32x4(0, -1, 0, -1)) - const h1 = v128.bitselect(f1, v128.add(f1, f1), i32x4(0, -1, 0, -1)) - const h2 = v128.bitselect(f2, v128.add(f2, f2), i32x4(0, -1, 0, -1)) - const h3 = v128.bitselect(f3, v128.add(f3, f3), i32x4(0, -1, 0, -1)) - const h4 = v128.bitselect(f4, v128.add(f4, f4), i32x4(0, -1, 0, -1)) + const m = i64x2(-1, 0) + const h0 = v128.add(f0, v128.and(f0, m)) + const h1 = v128.add(f1, v128.and(f1, m)) + const h2 = v128.add(f2, v128.and(f2, m)) + const h3 = v128.add(f3, v128.and(f3, m)) + const h4 = v128.add(f4, v128.and(f4, m)) v128.store(changetype(h), h0, 0 << 4) v128.store(changetype(h), h1, 1 << 4)