File tree Expand file tree Collapse file tree 2 files changed +54
-0
lines changed Expand file tree Collapse file tree 2 files changed +54
-0
lines changed Original file line number Diff line number Diff line change @@ -104,6 +104,9 @@ mod dox;
104
104
cfg_if ! {
105
105
if #[ cfg( all( target_arch = "wasm32" , not( target_os = "emscripten" ) ) ) ] {
106
106
// empty ...
107
+ } else if #[ cfg( target_os = "switch" ) ] {
108
+ // On the Switch, we only define some useful universal types for
109
+ // convenience. Those can be found in the switch.rs file.
107
110
} else {
108
111
109
112
// Use repr(u8) as LLVM expects `void*` to be the same as `i8*` to help enable
@@ -296,6 +299,9 @@ cfg_if! {
296
299
} else if #[ cfg( target_os = "fuchsia" ) ] {
297
300
mod fuchsia;
298
301
pub use fuchsia:: * ;
302
+ } else if #[ cfg( target_os = "switch" ) ] {
303
+ mod switch;
304
+ pub use switch:: * ;
299
305
} else if #[ cfg( unix) ] {
300
306
mod unix;
301
307
pub use unix:: * ;
Original file line number Diff line number Diff line change
1
+ //! Switch C type definitions
2
+
3
+ // Use repr(u8) as LLVM expects `void*` to be the same as `i8*` to help enable
4
+ // more optimization opportunities around it recognizing things like
5
+ // malloc/free.
6
+ #[ repr( u8 ) ]
7
+ pub enum c_void {
8
+ // Two dummy variants so the #[repr] attribute can be used.
9
+ #[ doc( hidden) ]
10
+ __variant1,
11
+ #[ doc( hidden) ]
12
+ __variant2,
13
+ }
14
+
15
+ pub type int8_t = i8 ;
16
+ pub type int16_t = i16 ;
17
+ pub type int32_t = i32 ;
18
+ pub type int64_t = i64 ;
19
+ pub type uint8_t = u8 ;
20
+ pub type uint16_t = u16 ;
21
+ pub type uint32_t = u32 ;
22
+ pub type uint64_t = u64 ;
23
+
24
+ pub type c_schar = i8 ;
25
+ pub type c_uchar = u8 ;
26
+ pub type c_short = i16 ;
27
+ pub type c_ushort = u16 ;
28
+ pub type c_int = i32 ;
29
+ pub type c_uint = u32 ;
30
+ pub type c_float = f32 ;
31
+ pub type c_double = f64 ;
32
+ pub type c_longlong = i64 ;
33
+ pub type c_ulonglong = u64 ;
34
+ pub type intmax_t = i64 ;
35
+ pub type uintmax_t = u64 ;
36
+
37
+ pub type size_t = usize ;
38
+ pub type ptrdiff_t = isize ;
39
+ pub type intptr_t = isize ;
40
+ pub type uintptr_t = usize ;
41
+ pub type ssize_t = isize ;
42
+
43
+ // Arch specific
44
+ pub type off_t = i64 ;
45
+ pub type c_char = u8 ;
46
+ pub type c_long = i64 ;
47
+ pub type c_ulong = u64 ;
48
+ pub type wchar_t = u32 ;
You can’t perform that action at this time.
0 commit comments