#[cfg(zisk_guest)]
use core::arch::asm;
#[cfg(zisk_guest)]
use crate::ziskos_syscall;
#[cfg(not(zisk_guest))]
use proofman_fields::{poseidon2_hash, Goldilocks, Poseidon2_16, PrimeField64};
#[allow(unused_variables)]
#[cfg_attr(not(feature = "hints"), no_mangle)]
#[cfg_attr(feature = "hints", export_name = "hints_syscall_poseidon2")]
pub unsafe extern "C" fn syscall_poseidon2(
state: *mut [u64; 16],
#[cfg(feature = "hints")] hints: &mut Vec<u64>,
) {
#[cfg(zisk_guest)]
ziskos_syscall!(zisk_definitions::SYSCALL_POSEIDON2_ID, state);
#[cfg(not(zisk_guest))]
{
let state: &mut [u64; 16] = unsafe { &mut *(state) };
let state_gl = state.map(Goldilocks::new);
let new_state_gl = poseidon2_hash::<Goldilocks, Poseidon2_16, 16>(&state_gl);
for (i, d) in state.iter_mut().enumerate() {
*d = new_state_gl[i].as_canonical_u64();
}
#[cfg(feature = "hints")]
{
hints.extend_from_slice(state);
}
}
}