Skip to content

Commit 9075858

Browse files
Use core::ffi::c_int instead of crate::mem::c_int
1 parent 3d07d3a commit 9075858

File tree

2 files changed

+5
-12
lines changed

2 files changed

+5
-12
lines changed

compiler-builtins/src/mem/impls.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -384,13 +384,13 @@ pub unsafe fn set_bytes(mut s: *mut u8, c: u8, mut n: usize) {
384384
}
385385

386386
#[inline(always)]
387-
pub unsafe fn compare_bytes(s1: *const u8, s2: *const u8, n: usize) -> crate::mem::c_int {
387+
pub unsafe fn compare_bytes(s1: *const u8, s2: *const u8, n: usize) -> core::ffi::c_int {
388388
let mut i = 0;
389389
while i < n {
390390
let a = *s1.wrapping_add(i);
391391
let b = *s2.wrapping_add(i);
392392
if a != b {
393-
return a as crate::mem::c_int - b as crate::mem::c_int;
393+
return a as core::ffi::c_int - b as core::ffi::c_int;
394394
}
395395
i += 1;
396396
}

compiler-builtins/src/mem/mod.rs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,6 @@
33
// FIXME(e2024): this eventually needs to be removed.
44
#![allow(unsafe_op_in_unsafe_fn)]
55

6-
#[allow(warnings)]
7-
#[cfg(target_pointer_width = "16")]
8-
type c_int = i16;
9-
#[allow(warnings)]
10-
#[cfg(not(target_pointer_width = "16"))]
11-
type c_int = i32;
12-
136
// memcpy/memmove/memset have optimized implementations on some architectures
147
#[cfg_attr(
158
all(not(feature = "no-asm"), target_arch = "x86_64"),
@@ -38,18 +31,18 @@ intrinsics! {
3831
}
3932

4033
#[mem_builtin]
41-
pub unsafe extern "C" fn memset(s: *mut u8, c: crate::mem::c_int, n: usize) -> *mut u8 {
34+
pub unsafe extern "C" fn memset(s: *mut u8, c: core::ffi::c_int, n: usize) -> *mut u8 {
4235
impls::set_bytes(s, c as u8, n);
4336
s
4437
}
4538

4639
#[mem_builtin]
47-
pub unsafe extern "C" fn memcmp(s1: *const u8, s2: *const u8, n: usize) -> crate::mem::c_int {
40+
pub unsafe extern "C" fn memcmp(s1: *const u8, s2: *const u8, n: usize) -> core::ffi::c_int {
4841
impls::compare_bytes(s1, s2, n)
4942
}
5043

5144
#[mem_builtin]
52-
pub unsafe extern "C" fn bcmp(s1: *const u8, s2: *const u8, n: usize) -> crate::mem::c_int {
45+
pub unsafe extern "C" fn bcmp(s1: *const u8, s2: *const u8, n: usize) -> core::ffi::c_int {
5346
memcmp(s1, s2, n)
5447
}
5548

0 commit comments

Comments
 (0)