1
Fork 0

make memcmp return a value of c_int_width instead of i32

This commit is contained in:
David Morrison 2021-11-10 20:14:23 -08:00
parent 8f96ef4bb5
commit aa67016624
7 changed files with 22 additions and 4 deletions

View file

@ -57,6 +57,9 @@ type_alias! { "c_schar.md", c_schar = i8, NonZero_c_schar = NonZeroI8; }
type_alias! { "c_uchar.md", c_uchar = u8, NonZero_c_uchar = NonZeroU8; }
type_alias! { "c_short.md", c_short = i16, NonZero_c_short = NonZeroI16; }
type_alias! { "c_ushort.md", c_ushort = u16, NonZero_c_ushort = NonZeroU16; }
#[cfg(any(target_arch = "avr", target_arch = "msp430"))]
type_alias! { "c_int.md", c_int = i16, NonZero_c_int = NonZeroI16; }
#[cfg(not(any(target_arch = "avr", target_arch = "msp430")))]
type_alias! { "c_int.md", c_int = i32, NonZero_c_int = NonZeroI32; }
type_alias! { "c_uint.md", c_uint = u32, NonZero_c_uint = NonZeroU32; }
type_alias! { "c_long.md", c_long = i32, NonZero_c_long = NonZeroI32;

View file

@ -1,6 +1,7 @@
//! Comparison traits for `[T]`.
use crate::cmp::{self, Ordering};
use crate::ffi;
use crate::mem;
use super::from_raw_parts;
@ -13,8 +14,7 @@ extern "C" {
///
/// Returns 0 for equal, < 0 for less than and > 0 for greater
/// than.
// FIXME(#32610): Return type should be c_int
fn memcmp(s1: *const u8, s2: *const u8, n: usize) -> i32;
fn memcmp(s1: *const u8, s2: *const u8, n: usize) -> ffi::c_int;
}
#[stable(feature = "rust1", since = "1.0.0")]