]> git.codecow.com Git - nano25519.git/commitdiff
High bits of h are zero after carry, so scrap the extra lanes.
authorChris Duncan <chris@codecow.com>
Mon, 26 Oct 2026 20:03:56 +0000 (13:03 -0700)
committerChris Duncan <chris@codecow.com>
Mon, 26 Oct 2026 20:03:56 +0000 (13:03 -0700)
src/assembly/ed25519/fep.ts

index 0238494cdbd63a2b3aa7acfac07187c971c2b504..6b0d10c0e649410f8eca9fd97fa1e6cdd9c5d2d4 100644 (file)
@@ -994,11 +994,11 @@ export function fep_mul_lane (h: FieldElementPair, f: FieldElementPair, g: Field
        h1 += carry0
 
        // reduce i64x2 to i32x4 now that high bits are zero and low bits fit into i32
-       h01 = i32x4(<i32>h0, 0, <i32>h1, 0)
-       h23 = i32x4(<i32>h2, 0, <i32>h3, 0)
-       h45 = i32x4(<i32>h4, 0, <i32>h5, 0)
-       h67 = i32x4(<i32>h6, 0, <i32>h7, 0)
-       h89 = i32x4(<i32>h8, 0, <i32>h9, 0)
+       h01 = i64x2(h0, h1)
+       h23 = i64x2(h2, h3)
+       h45 = i64x2(h4, h5)
+       h67 = i64x2(h6, h7)
+       h89 = i64x2(h8, h9)
 
        // assign results to output
        v128.store(changetype<usize>(h), v128.shuffle<i32>(h01, f01, 0, 5, 2, 7), 0 << 4) // h0, f0, h1, f1