zink/ffi/
bytes.rs

1//! Bytes based instructions
2
3use crate::primitives::*;
4
5macro_rules! impl_bytes {
6    ($($count:expr),*) => {
7        #[link(wasm_import_module = "bytes")]
8        #[allow(improper_ctypes)]
9        extern "C" {
10            paste::paste! {
11              $(
12                #[doc = concat!("Push ", stringify!($count), " bytes to stack")]
13                pub fn [< push_bytes $count >] (bytes: [< Bytes $count >]);
14
15                #[doc = concat!("Load ", stringify!($count), " bytes from storage")]
16                pub fn [< sload_bytes $count >] () -> [< Bytes $count >];
17
18                #[doc = concat!("TLoad ", stringify!($count), " bytes from transient storage")]
19                pub fn [< tload_bytes $count >] () -> [< Bytes $count >];
20
21                #[doc = concat!("Check equal for bytes", stringify!($count))]
22                pub fn [< bytes $count _eq >] (this: [< Bytes $count >], other: [< Bytes $count >]) -> bool;
23              )*
24            }
25        }
26    };
27}
28
29impl_bytes!(
30    2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
31    28, 29, 30, 31, 32
32);