Fix panic on non-x86 platforms

This panic'ed because fused_addassign_mul_scalar does not support
scalar=1, and it was used as the fallback
This commit is contained in:
Christopher Berner 2021-02-08 20:45:35 -08:00
parent 30ed32e720
commit c134e5b93e

@ -86,7 +86,11 @@ pub fn fused_addassign_mul_scalar_binary(
}
// TODO: write an optimized fallback that does call .to_octet_vec()
return fused_addassign_mul_scalar(octets, &other.to_octet_vec(), scalar);
if *scalar == Octet::one() {
return add_assign(octets, &other.to_octet_vec());
} else {
return fused_addassign_mul_scalar(octets, &other.to_octet_vec(), scalar);
}
}
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]