types.rs 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. use core::i32;
  2. // Use repr(u8) as LLVM expects `void*` to be the same as `i8*` to help enable
  3. // more optimization opportunities around it recognizing things like
  4. // malloc/free.
  5. #[repr(u8)]
  6. pub enum c_void {
  7. // Two dummy variants so the #[repr] attribute can be used.
  8. #[doc(hidden)]
  9. __variant1,
  10. #[doc(hidden)]
  11. __variant2,
  12. }
  13. pub type int8_t = i8;
  14. pub type int16_t = i16;
  15. pub type int32_t = i32;
  16. pub type int64_t = i64;
  17. pub type uint8_t = u8;
  18. pub type uint16_t = u16;
  19. pub type uint32_t = u32;
  20. pub type uint64_t = u64;
  21. pub type c_schar = i8;
  22. pub type c_uchar = u8;
  23. pub type c_short = i16;
  24. pub type c_ushort = u16;
  25. pub type c_int = i32;
  26. pub type c_uint = u32;
  27. pub type c_float = f32;
  28. pub type c_double = f64;
  29. pub type c_longlong = i64;
  30. pub type c_ulonglong = u64;
  31. pub type intmax_t = i64;
  32. pub type uintmax_t = u64;
  33. pub type size_t = usize;
  34. pub type ptrdiff_t = isize;
  35. pub type intptr_t = isize;
  36. pub type uintptr_t = usize;
  37. pub type ssize_t = isize;
  38. pub type c_char = i8;
  39. #[cfg(target_pointer_width = "32")]
  40. pub type c_long = i32;
  41. #[cfg(target_pointer_width = "32")]
  42. pub type c_ulong = u32;
  43. #[cfg(target_pointer_width = "64")]
  44. pub type c_long = i64;
  45. #[cfg(target_pointer_width = "64")]
  46. pub type c_ulong = u64;
  47. pub type wchar_t = i32;
  48. pub type wint_t = u32;
  49. pub type regoff_t = size_t;
  50. pub type off_t = c_longlong;
  51. pub type mode_t = c_int;
  52. pub type time_t = c_longlong;
  53. pub type pid_t = c_int;
  54. pub type id_t = c_uint;
  55. pub type gid_t = c_int;
  56. pub type uid_t = c_int;
  57. pub type dev_t = c_long;
  58. pub type ino_t = c_ulong;
  59. pub type nlink_t = c_ulong;
  60. pub type blksize_t = c_long;
  61. pub type blkcnt_t = c_ulong;
  62. pub type fsblkcnt_t = c_ulong;
  63. pub type fsfilcnt_t = c_ulong;
  64. pub type useconds_t = c_uint;
  65. pub type suseconds_t = c_int;
  66. pub type clock_t = c_long;
  67. pub type clockid_t = c_int;
  68. pub type timer_t = *mut c_void;