Skip to content
Snippets Groups Projects
Commit 8ff70b6a authored by roblabla's avatar roblabla
Browse files

Add some switch-related libc typedefs

parent 8318a3ec
No related branches found
No related tags found
No related merge requests found
......@@ -104,6 +104,9 @@ mod dox;
cfg_if! {
if #[cfg(all(target_arch = "wasm32", not(target_os = "emscripten")))] {
// empty ...
} else if #[cfg(target_os = "switch")] {
// On the Switch, we only define some useful universal types for
// convenience. Those can be found in the switch.rs file.
} else {
// Use repr(u8) as LLVM expects `void*` to be the same as `i8*` to help enable
......@@ -296,6 +299,9 @@ cfg_if! {
} else if #[cfg(target_os = "fuchsia")] {
mod fuchsia;
pub use fuchsia::*;
} else if #[cfg(target_os = "switch")] {
mod switch;
pub use switch::*;
} else if #[cfg(unix)] {
mod unix;
pub use unix::*;
......
//! Switch C type definitions
// Use repr(u8) as LLVM expects `void*` to be the same as `i8*` to help enable
// more optimization opportunities around it recognizing things like
// malloc/free.
#[repr(u8)]
pub enum c_void {
// Two dummy variants so the #[repr] attribute can be used.
#[doc(hidden)]
__variant1,
#[doc(hidden)]
__variant2,
}
pub type int8_t = i8;
pub type int16_t = i16;
pub type int32_t = i32;
pub type int64_t = i64;
pub type uint8_t = u8;
pub type uint16_t = u16;
pub type uint32_t = u32;
pub type uint64_t = u64;
pub type c_schar = i8;
pub type c_uchar = u8;
pub type c_short = i16;
pub type c_ushort = u16;
pub type c_int = i32;
pub type c_uint = u32;
pub type c_float = f32;
pub type c_double = f64;
pub type c_longlong = i64;
pub type c_ulonglong = u64;
pub type intmax_t = i64;
pub type uintmax_t = u64;
pub type size_t = usize;
pub type ptrdiff_t = isize;
pub type intptr_t = isize;
pub type uintptr_t = usize;
pub type ssize_t = isize;
// Arch specific
pub type off_t = i64;
pub type c_char = u8;
pub type c_long = i64;
pub type c_ulong = u64;
pub type wchar_t = u32;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment