1 //! Switch C type definitions 2 3 pub type int8_t = i8; 4 pub type int16_t = i16; 5 pub type int32_t = i32; 6 pub type int64_t = i64; 7 pub type uint8_t = u8; 8 pub type uint16_t = u16; 9 pub type uint32_t = u32; 10 pub type uint64_t = u64; 11 12 pub type c_schar = i8; 13 pub type c_uchar = u8; 14 pub type c_short = i16; 15 pub type c_ushort = u16; 16 pub type c_int = i32; 17 pub type c_uint = u32; 18 pub type c_float = f32; 19 pub type c_double = f64; 20 pub type c_longlong = i64; 21 pub type c_ulonglong = u64; 22 pub type intmax_t = i64; 23 pub type uintmax_t = u64; 24 25 pub type size_t = usize; 26 pub type ptrdiff_t = isize; 27 pub type intptr_t = isize; 28 pub type uintptr_t = usize; 29 pub type ssize_t = isize; 30 31 pub type off_t = i64; 32 pub type c_char = u8; 33 pub type c_long = i64; 34 pub type c_ulong = u64; 35 pub type wchar_t = u32; 36 37 pub const INT_MIN: c_int = -2147483648; 38 pub const INT_MAX: c_int = 2147483647; 39 40 cfg_if! { 41 if #[cfg(core_cvoid)] { 42 pub use core::ffi::c_void; 43 } else { 44 // Use repr(u8) as LLVM expects `void*` to be the same as `i8*` to help 45 // enable more optimization opportunities around it recognizing things 46 // like malloc/free. 47 #[repr(u8)] 48 pub enum c_void { 49 // Two dummy variants so the #[repr] attribute can be used. 50 #[doc(hidden)] 51 __variant1, 52 #[doc(hidden)] 53 __variant2, 54 } 55 } 56 } 57 58