Skip to content

Instantly share code, notes, and snippets.

@jwasinger
Last active May 2, 2020 21:31
Show Gist options
  • Save jwasinger/4dd28745ae1b9c27a8cea13d24a40e9f to your computer and use it in GitHub Desktop.
Save jwasinger/4dd28745ae1b9c27a8cea13d24a40e9f to your computer and use it in GitHub Desktop.
function f6m_mul(x_offset, y_offset, ret_offset, mod_offset, inv_offset) {
/*
f6m_mul pseudocode:
a = x_offset[0]
b = x_offset[1]
A = y_offset[0]
B = y_offset[1]
aA = a * A
bB = b * B
...
*/
// aA <- a
memcpy_384(mem_end, x_offset)
// aA <- aA * A
mulmodmont384(mem_end, y_offset)
// bB <- b
memcpy_384(add(mem_end, 64), add(x_offset, 64))
// bB <- bB * B
mulmodmont384(add(mem_end, 64), add(y_offset, 64))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment