Skip to content
Closed
Changes from 1 commit
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
34 changes: 26 additions & 8 deletions simplicity-sys/src/ffi.rs
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, I am not sure about the

#[cfg(not(target_arch = "wasm32"))]
pub type c_uint_fast64_t = usize;

Because of: https://en.cppreference.com/w/c/types/integer.html

image

As far as I understand on 32-bit platforms like armv7 because we are using the usize this thing could fail

Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,36 @@ pub type c_int = i32;
pub type c_uint = u32;
pub type c_size_t = usize;
pub type c_uint_fast8_t = u8;
#[cfg(all(
any(target_arch = "wasm32", target_arch = "aarch64"),
not(target_os = "windows")
))]
#[cfg(any(target_os = "macos", target_os = "ios"))]
pub type c_uint_fast16_t = u16;
#[cfg(target_os = "windows")]
#[cfg(any(target_os = "windows", target_os = "android"))]
pub type c_uint_fast16_t = u32;
#[cfg(not(any(target_arch = "wasm32", target_arch = "aarch64", target_os = "windows")))]
#[cfg(target_arch = "wasm32")]
pub type c_uint_fast16_t = u16;
#[cfg(not(any(
target_os = "macos",
target_os = "ios",
target_os = "windows",
target_os = "android",
target_arch = "wasm32"
)))]
pub type c_uint_fast16_t = usize;
#[cfg(any(target_arch = "wasm32", target_arch = "aarch64", target_os = "windows"))]

#[cfg(any(
target_os = "macos",
target_os = "ios",
target_os = "windows",
target_os = "android",
target_arch = "wasm32"
))]
pub type c_uint_fast32_t = u32;
#[cfg(not(any(target_arch = "wasm32", target_arch = "aarch64", target_os = "windows")))]
#[cfg(not(any(
target_os = "macos",
target_os = "ios",
target_os = "windows",
target_os = "android",
target_arch = "wasm32"
)))]
pub type c_uint_fast32_t = usize;
#[cfg(target_arch = "wasm32")]
pub type c_uint_fast64_t = u64;
Expand Down