| 1 |
//! Hermit C types definition |
| 2 |
|
| 3 |
pub type c_schar = i8; |
| 4 |
pub type c_uchar = u8; |
| 5 |
pub type c_short = i16; |
| 6 |
pub type c_ushort = u16; |
| 7 |
pub type c_int = i32; |
| 8 |
pub type c_uint = u32; |
| 9 |
pub type c_float = f32; |
| 10 |
pub type c_double = f64; |
| 11 |
pub type c_longlong = i64; |
| 12 |
pub type c_ulonglong = u64; |
| 13 |
pub type intmax_t = i64; |
| 14 |
pub type uintmax_t = u64; |
| 15 |
|
| 16 |
pub type size_t = usize; |
| 17 |
pub type ptrdiff_t = isize; |
| 18 |
pub type intptr_t = isize; |
| 19 |
pub type uintptr_t = usize; |
| 20 |
pub type ssize_t = isize; |
| 21 |
|
| 22 |
pub type c_long = i64; |
| 23 |
pub type c_ulong = u64; |
| 24 |
|
| 25 |
pub type wint_t = u32; |
| 26 |
pub type wctype_t = i64; |
| 27 |
|
| 28 |
pub type regoff_t = size_t; |
| 29 |
pub type off_t = c_long; |
| 30 |
|
| 31 |
cfg_if! { |
| 32 |
if #[cfg(target_arch = "aarch64")] { |
| 33 |
mod aarch64; |
| 34 |
pub use self::aarch64::*; |
| 35 |
} else if #[cfg(target_arch = "x86_64")] { |
| 36 |
mod x86_64; |
| 37 |
pub use self::x86_64::*; |
| 38 |
} else { |
| 39 |
// Unknown target_arch |
| 40 |
} |
| 41 |
} |
| 42 |
|
| 43 |
cfg_if! { |
| 44 |
if #[cfg(libc_core_cvoid)] { |
| 45 |
pub use ::ffi::c_void; |
| 46 |
} else { |
| 47 |
// Use repr(u8) as LLVM expects `void*` to be the same as `i8*` to help |
| 48 |
// enable more optimization opportunities around it recognizing things |
| 49 |
// like malloc/free. |
| 50 |
#[repr(u8)] |
| 51 |
#[allow(missing_copy_implementations)] |
| 52 |
#[allow(missing_debug_implementations)] |
| 53 |
pub enum c_void { |
| 54 |
// Two dummy variants so the #[repr] attribute can be used. |
| 55 |
#[doc(hidden)] |
| 56 |
__variant1, |
| 57 |
#[doc(hidden)] |
| 58 |
__variant2, |
| 59 |
} |
| 60 |
} |
| 61 |
} |