linux_uapi/
types.rs

1// Copyright 2023 The Fuchsia Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5pub type c_void = ::std::ffi::c_void;
6
7// `char` is signed on x86_64, but unsigned on arm64 and riscv.
8#[cfg(target_arch = "x86_64")]
9pub type c_char = i8;
10#[cfg(any(target_arch = "arm", target_arch = "aarch64", target_arch = "riscv64"))]
11pub type c_char = u8;
12
13#[cfg(any(target_arch = "x86_64", target_arch = "aarch64", target_arch = "riscv64"))]
14mod common {
15    pub type c_schar = i8;
16    pub type c_uchar = u8;
17    pub type c_short = i16;
18    pub type c_ushort = u16;
19    pub type c_int = i32;
20    pub type c_uint = u32;
21    pub type c_long = i64;
22    pub type c_ulong = u64;
23    pub type c_longlong = i64;
24    pub type c_ulonglong = u64;
25}
26
27// Export for 'arm' which is only used via arch32
28#[allow(dead_code)]
29pub mod arch32 {
30    pub type c_char = u8;
31
32    pub type c_schar = i8;
33    pub type c_uchar = u8;
34    pub type c_short = i16;
35    pub type c_ushort = u16;
36    pub type c_int = i32;
37    pub type c_uint = u32;
38    pub type c_long = i32;
39    pub type c_ulong = u32;
40    pub type c_longlong = i64;
41    pub type c_ulonglong = u64;
42}
43
44pub use common::*;