Skip to content

Commit

Permalink
logs
Browse files Browse the repository at this point in the history
  • Loading branch information
malik672 committed Dec 6, 2024
1 parent 16ecb5c commit a67fde1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
4 changes: 4 additions & 0 deletions zink/src/ffi/asm.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
//! Assembly FFI.
use crate::primitives::{Bytes32, U256};

#[link(wasm_import_module = "asm")]
#[allow(improper_ctypes)]
extern "C" {
Expand Down Expand Up @@ -79,6 +81,8 @@ extern "C" {
/// Revert with message in 128 bytes
pub fn revert4(message: &'static str);

pub fn cast_bytes32(a: U256) -> Bytes32;

/// Load a 8-bit signed integer from the storage.
pub fn sload_i8() -> i8;

Expand Down
9 changes: 1 addition & 8 deletions zink/src/primitives/u256.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,11 @@ impl U256 {
unsafe { ffi::u256_max() }
}


#[cfg(target_family = "wasm")]
/// U256 to bytes32
pub fn to_bytes32(&self) -> Bytes32 {
unsafe { ffi::asm::cast_bytes32(*self) }
}

#[cfg(not(target_family = "wasm"))]
pub fn to_bytes32(&self) -> Bytes32 {
// Bytes32::from(self.0)
todo!()
}

/// Addmod for U256
#[inline(always)]
pub fn addmod(self, other: Self, modulus: Self) -> Self {
Expand Down

0 comments on commit a67fde1

Please sign in to comment.