Add docs for inttypes.h

This commit is contained in:
Peter Limkilde Svendsen
2024-11-09 18:24:18 +01:00
parent a45c7b26d9
commit 2f1e183cc6
+11
View File
@@ -1,19 +1,26 @@
//! `inttypes.h` implementation.
//!
//! See <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/inttypes.h.html>.
use crate::{
header::{ctype, errno::*, stdlib::*},
platform::{self, types::*},
};
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/imaxabs.html>.
#[no_mangle]
pub extern "C" fn imaxabs(i: intmax_t) -> intmax_t {
i.abs()
}
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/inttypes.h.html>.
#[repr(C)]
pub struct imaxdiv_t {
quot: intmax_t,
rem: intmax_t,
}
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/imaxdiv.html>.
#[no_mangle]
pub extern "C" fn imaxdiv(i: intmax_t, j: intmax_t) -> imaxdiv_t {
imaxdiv_t {
@@ -22,6 +29,7 @@ pub extern "C" fn imaxdiv(i: intmax_t, j: intmax_t) -> imaxdiv_t {
}
}
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/strtoimax.html>.
#[no_mangle]
pub unsafe extern "C" fn strtoimax(
s: *const c_char,
@@ -39,6 +47,7 @@ pub unsafe extern "C" fn strtoimax(
)
}
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/strtoimax.html>.
#[no_mangle]
pub unsafe extern "C" fn strtoumax(
s: *const c_char,
@@ -55,3 +64,5 @@ pub unsafe extern "C" fn strtoumax(
base
)
}
// wcstoimax(), wcstoumax() currently defined in header::wchar?