* two reasons:
* 1. There is no vectorized 64-bit data type in Wasm, only 128-bit, so \`v128\`
* must be used in the form of \`i32x4\` to achieve SIMD parallelism, and
- * 2. \`i32x4.load\` will load lanes \`[0, 1]\` for elements [8,9] just fine but
- * risks retrieving garbage data for lanes \`[2, 3]\` from some other chunk of
+ * 2. \`i32x4.load\` will load lanes \`[0,1]\` for elements [8,9] just fine but
+ * risks retrieving garbage data for lanes \`[2,3]\` from some other chunk of
* memory if it is not allocated to this FieldElement, so elements [10,11] are
* reserved, initialized to zero, and simply ignored throughout computation.
*/
* Square a FieldElement and store the result.
*
* Some iterations of the inner loop can be skipped since
- * \`f[x] * f[y] + f[y] * f[x] = 2 * f[x] * f[y]\`
+ * \`f[x]*f[y] + f[y]*f[x] = 2*f[x]*f[y]\`
*
* \`\`\`
- * // non-constant-time example
+ * // non-constant-time example
* for (let i = 0; i < 10; i++) {
* for (let j = i; j < 10; j++) {
- * h[i + j] += f[i] * g[j]
- * if (i < j) {
- * h[i + j] *= 2
- * }
+ * h[i + j] += f[i] * g[j]
+ * if (i < j) {
+ * h[i + j] *= 2
+ * }
* }
* }
* \`\`\`
* Square a FieldElement and store the result.
*
* Some iterations of the inner loop can be skipped since
- * \`f[x] * f[y] + f[y] * f[x] = 2 * f[x] * f[y]\`
+ * \`f[x]*f[y] + f[y]*f[x] = 2*f[x]*f[y]\`
*
* \`\`\`
- * // non-constant-time example
+ * // non-constant-time example
* for (let i = 0; i < 10; i++) {
* for (let j = i; j < 10; j++) {
- * h[i + j] += f[i] * g[j]
- * if (i < j) {
- * h[i + j] *= 2
- * }
+ * h[i + j] += f[i] * g[j]
+ * if (i < j) {
+ * h[i + j] *= 2
+ * }
* }
* }
* \`\`\`
import { GE } from './ge.gen.mjs'
import { P } from './p.gen.mjs'
-await writeFile('src/assembly/ed25519/blake2b.ts', BLAKE2b)
-// await writeFile('src/assembly/ed25519/fe.ts', FE)
-// await writeFile('src/assembly/ed25519/ge.ts', GE)
-// await writeFile('src/assembly/ed25519/p.ts', P)
+/** @type {(s: string) => any} */
+const stripNewline = s => s.replaceAll(/\n(\s*\n){2,}/gm, '\n\n')
+
+await writeFile('src/assembly/ed25519/blake2b.ts', stripNewline(BLAKE2b))
+// await writeFile('src/assembly/ed25519/fe.ts', stripNewline(FE))
+// await writeFile('src/assembly/ed25519/ge.ts', stripNewline(GE))
+// await writeFile('src/assembly/ed25519/p.ts', stripNewline(P))