error_code/types.rs
1//! C types used inside crate
2#![allow(non_camel_case_types)]
3
4//Reference: https://github.com/rust-lang/rust/blob/999967a57dce987bbad353d152f03c3ef67d41f2/library/core/src/ffi/primitives.rs#L176
5#[cfg(any(target_arch = "avr", target_arch = "msp430"))]
6mod ints {
7 ///C type `int`
8 pub type c_int = i16;
9 ///C type `unsigned int`
10 pub type c_uint = u16;
11}
12
13#[cfg(not(any(target_arch = "avr", target_arch = "msp430")))]
14mod ints {
15 ///C type `int`
16 pub type c_int = i32;
17 ///C type `unsigned int`
18 pub type c_uint = u32;
19}
20
21#[cfg(any(
22 all(target_pointer_width = "64", not(windows)),
23 //Reference: https://github.com/rust-lang/rust/blob/999967a57dce987bbad353d152f03c3ef67d41f2/library/core/src/ffi/primitives.rs#L139
24 all(target_arch = "wasm32", target_os = "linux")
25))]
26mod longs {
27 ///C type `unsigned long`
28 pub type c_ulong = u64;
29}
30
31#[cfg(not(any(
32 all(target_pointer_width = "64", not(windows)),
33 //Reference: https://github.com/rust-lang/rust/blob/999967a57dce987bbad353d152f03c3ef67d41f2/library/core/src/ffi/primitives.rs#L139
34 all(target_arch = "wasm32", target_os = "linux")
35)))]
36mod longs {
37 ///C type `unsigned long`
38 pub type c_ulong = u32;
39}
40
41pub use ints::*;
42pub use longs::*;