File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change 44#![ cfg_attr( not( feature = "no-asm" ) , feature( global_asm) ) ]
55#![ feature( cfg_target_has_atomic) ]
66#![ feature( compiler_builtins) ]
7+ #![ feature( core_ffi_c) ]
78#![ feature( core_intrinsics) ]
89#![ feature( lang_items) ]
910#![ feature( linkage) ]
Original file line number Diff line number Diff line change @@ -68,6 +68,18 @@ intrinsics! {
6868 pub unsafe extern "C" fn bcmp( s1: * const u8 , s2: * const u8 , n: usize ) -> i32 {
6969 memcmp( s1, s2, n)
7070 }
71+
72+ #[ mem_builtin]
73+ #[ cfg_attr( not( all( target_os = "windows" , target_env = "gnu" ) ) , linkage = "weak" ) ]
74+ pub unsafe extern "C" fn strlen( s: * const core:: ffi:: c_char) -> usize {
75+ let mut n = 0 ;
76+ let mut s = s;
77+ while * s != 0 {
78+ n += 1 ;
79+ s = s. offset( 1 ) ;
80+ }
81+ n
82+ }
7183}
7284
7385// `bytes` must be a multiple of `mem::size_of::<T>()`
You can’t perform that action at this time.
0 commit comments