1 use crate::{ 2 header::{ctype, errno::*, stdlib::*}, 3 platform::{self, types::*}, 4 }; 5 6 #[no_mangle] 7 pub extern "C" fn imaxabs(i: intmax_t) -> intmax_t { 8 i.abs() 9 } 10 11 #[no_mangle] 12 #[repr(C)] 13 pub struct imaxdiv_t { 14 quot: intmax_t, 15 rem: intmax_t, 16 } 17 18 #[no_mangle] 19 pub extern "C" fn imaxdiv(i: intmax_t, j: intmax_t) -> imaxdiv_t { 20 imaxdiv_t { 21 quot: i / j, 22 rem: i % j, 23 } 24 } 25 26 #[no_mangle] 27 pub unsafe extern "C" fn strtoimax( 28 s: *const c_char, 29 endptr: *mut *mut c_char, 30 base: c_int, 31 ) -> intmax_t { 32 strto_impl!( 33 intmax_t, 34 false, 35 intmax_t::max_value(), 36 intmax_t::min_value(), 37 s, 38 endptr, 39 base 40 ) 41 } 42 43 #[no_mangle] 44 pub unsafe extern "C" fn strtoumax( 45 s: *const c_char, 46 endptr: *mut *mut c_char, 47 base: c_int, 48 ) -> uintmax_t { 49 strto_impl!( 50 uintmax_t, 51 false, 52 uintmax_t::max_value(), 53 uintmax_t::min_value(), 54 s, 55 endptr, 56 base 57 ) 58 } 59 60 #[allow(unused)] 61 // #[no_mangle] 62 pub extern "C" fn wcstoimax( 63 nptr: *const wchar_t, 64 endptr: *mut *mut wchar_t, 65 base: c_int, 66 ) -> intmax_t { 67 unimplemented!(); 68 } 69 70 #[allow(unused)] 71 // #[no_mangle] 72 pub extern "C" fn wcstoumax( 73 nptr: *const wchar_t, 74 endptr: *mut *mut wchar_t, 75 base: c_int, 76 ) -> uintmax_t { 77 unimplemented!(); 78 } 79