Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/fr_sp1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub struct Fr(pub(crate) [u32; 8]);

#[inline]
fn syscall_bn254_scalar_mul(p: *mut u32, q: *const u32) {
const BN254_SCALAR_MUL: u32 = 0x00_01_01_20;
const BN254_SCALAR_MUL: u32 = 0x00_01_01_80;
unsafe {
asm!(
"ecall",
Expand All @@ -32,7 +32,7 @@ fn syscall_bn254_scalar_mul(p: *mut u32, q: *const u32) {
}
#[inline]
fn syscall_bn254_scalar_mac(ret: *mut u32, a: *const u32, b: *const u32) {
const BN254_SCALAR_MAC: u32 = 0x00_01_01_21;
const BN254_SCALAR_MAC: u32 = 0x00_01_01_81;
unsafe {
asm!(
"ecall",
Expand Down Expand Up @@ -171,6 +171,7 @@ impl Fr {
}

pub fn add(&self, rhs: &Self) -> Fr {
println!("cycle-tracker-start: Fr::add");
let mut p = core::mem::MaybeUninit::<[u32; 8]>::uninit();

let src_ptr = self.0.as_ptr() as *const u32;
Expand All @@ -183,6 +184,7 @@ impl Fr {
}

let p = unsafe { p.assume_init() };
println!("cycle-tracker-end: Fr::add");
Fr(p)
}
}
Expand Down