interop: add interop API for MODMUL, MODPOW opcodes

This commit is contained in:
Anna Shaleva 2022-05-12 14:23:22 +03:00
parent e66e82278c
commit e31f4ca331
2 changed files with 51 additions and 0 deletions

View file

@ -44,3 +44,14 @@ func Min(a, b int) int {
func Within(x, a, b int) bool {
return neogointernal.Opcode3("WITHIN", x, a, b).(bool)
}
// ModMul returns the result of modulus division on a*b.
func ModMul(a, b, mod int) int {
return neogointernal.Opcode3("MODMUL", a, b, mod).(int)
}
// ModPow returns the result of modulus division on a^b. If b is -1,
// it returns the modular inverse of a.
func ModPow(a, b, mod int) int {
return neogointernal.Opcode3("MODPOW", a, b, mod).(int)
}