diff --git a/crates/wiggle/src/guest_type.rs b/crates/wiggle/src/guest_type.rs index 7eabd0f025..422c3f2394 100644 --- a/crates/wiggle/src/guest_type.rs +++ b/crates/wiggle/src/guest_type.rs @@ -88,7 +88,7 @@ macro_rules! primitives { if ptr.mem().is_borrowed(region) { return Err(GuestError::PtrBorrowed(region)); } - Ok(unsafe { *host_ptr.cast::() }) + Ok(unsafe { <$i>::from_le_bytes(*host_ptr.cast::<[u8; mem::size_of::()]>()) }) } #[inline] @@ -108,7 +108,7 @@ macro_rules! primitives { return Err(GuestError::PtrBorrowed(region)); } unsafe { - *host_ptr.cast::() = val; + *host_ptr.cast::<[u8; mem::size_of::()]>() = <$i>::to_le_bytes(val); } Ok(()) }