mirror of
https://git.planet-casio.com/Vhex-Kernel-Core/fxlibc.git
synced 2025-04-19 17:37:09 +02:00
inttypes: add imaxabs and imaxdiv (TEST)
This commit is contained in:
parent
73b536bbb6
commit
36b4854137
5 changed files with 33 additions and 2 deletions
|
@ -77,6 +77,9 @@ set(SOURCES
|
||||||
src/libc/ctype/toupper.c
|
src/libc/ctype/toupper.c
|
||||||
# errno
|
# errno
|
||||||
src/libc/errno/errno.c
|
src/libc/errno/errno.c
|
||||||
|
# inttypes
|
||||||
|
src/libc/inttypes/imaxabs.c
|
||||||
|
src/libc/inttypes/imaxdiv.c
|
||||||
# locale
|
# locale
|
||||||
src/libc/locale/setlocale.c
|
src/libc/locale/setlocale.c
|
||||||
src/libc/locale/localeconv.c
|
src/libc/locale/localeconv.c
|
||||||
|
|
4
STATUS
4
STATUS
|
@ -47,8 +47,8 @@ DONE: Function/symbol/macro is defined, builds, links, and is tested
|
||||||
7.8 <inttypes.h>
|
7.8 <inttypes.h>
|
||||||
7.8.1 PRI* macros: LDEPS(*printf)
|
7.8.1 PRI* macros: LDEPS(*printf)
|
||||||
7.8.1 SCN* macros: LDEPS(*scanf)
|
7.8.1 SCN* macros: LDEPS(*scanf)
|
||||||
7.8.2.1 imaxabs: TODO
|
7.8.2.1 imaxabs: TEST
|
||||||
7.8.2.2 imaxdiv: TODO
|
7.8.2.2 imaxdiv: TEST
|
||||||
7.8.2.3 strotimax strtoumax: TODO
|
7.8.2.3 strotimax strtoumax: TODO
|
||||||
7.8.2.4 wcstoimax wcstoumax: TODO
|
7.8.2.4 wcstoimax wcstoumax: TODO
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
# define __INTTYPES_H__
|
# define __INTTYPES_H__
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
/* Hide by default in C++ (7.8.1§1.181) */
|
/* Hide by default in C++ (7.8.1§1.181) */
|
||||||
#if !defined __cplusplus || defined __STDC_FORMAT_MACROS
|
#if !defined __cplusplus || defined __STDC_FORMAT_MACROS
|
||||||
|
@ -231,4 +232,15 @@
|
||||||
|
|
||||||
#endif /* !defined __cplusplus || defined __STDC_FORMAT_MACROS */
|
#endif /* !defined __cplusplus || defined __STDC_FORMAT_MACROS */
|
||||||
|
|
||||||
|
/* Return type of imaxdiv. */
|
||||||
|
typedef lldiv_t imaxdiv_t;
|
||||||
|
|
||||||
|
/* Absolue value of an intmax_t. */
|
||||||
|
extern intmax_t imaxabs(intmax_t __j);
|
||||||
|
#define imaxabs llabs
|
||||||
|
|
||||||
|
/* Integer division of intmax_t. */
|
||||||
|
extern imaxdiv_t imaxdiv(intmax_t __num, intmax_t __denom);
|
||||||
|
#define imaxdiv lldiv
|
||||||
|
|
||||||
#endif /*__INTTYPES_H__*/
|
#endif /*__INTTYPES_H__*/
|
||||||
|
|
8
src/libc/inttypes/imaxabs.c
Normal file
8
src/libc/inttypes/imaxabs.c
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
#include <inttypes.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#undef imaxabs
|
||||||
|
|
||||||
|
intmax_t imaxabs(intmax_t j)
|
||||||
|
{
|
||||||
|
return llabs(j);
|
||||||
|
}
|
8
src/libc/inttypes/imaxdiv.c
Normal file
8
src/libc/inttypes/imaxdiv.c
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
#include <inttypes.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#undef imaxdiv
|
||||||
|
|
||||||
|
imaxdiv_t imaxdiv(intmax_t num, intmax_t denom)
|
||||||
|
{
|
||||||
|
return lldiv(num, denom);
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue