1 //! Mapping from C types to their Rust equivalents 2 #![allow(dead_code)] 3 4 #[cfg(not(any(target_arch = "aarch64", target_arch = "arm", target_arch = "x86_64")))] 5 compile_error!("Only aarch64, arm, and x86_64 architectures are currently supported."); 6 7 pub use core::ffi::c_void; 8 9 #[cfg(any(target_arch = "aarch64", target_arch = "arm"))] 10 pub type c_char = u8; 11 12 #[cfg(target_arch = "x86_64")] 13 pub type c_char = i8; 14 15 pub type c_schar = i8; 16 17 pub type c_uchar = u8; 18 19 pub type c_short = i16; 20 21 pub type c_ushort = u16; 22 23 pub type c_int = i32; 24 pub type c_uint = u32; 25 26 #[cfg(target_pointer_width = "32")] 27 pub type c_long = i32; 28 #[cfg(target_pointer_width = "64")] 29 pub type c_long = i64; 30 31 #[cfg(target_pointer_width = "32")] 32 pub type c_ulong = u32; 33 #[cfg(target_pointer_width = "64")] 34 pub type c_ulong = u64; 35 36 pub type c_longlong = i64; 37 pub type c_ulonglong = u64; 38 39 pub type c_uint8_t = u8; 40 pub type c_uint16_t = u16; 41 pub type c_uint32_t = u32; 42 pub type c_uint64_t = u64; 43 44 pub type c_int8_t = i8; 45 pub type c_int16_t = i16; 46 pub type c_int32_t = i32; 47 pub type c_int64_t = i64; 48