LibC: Add imaxabs

This commit is contained in:
matyalatte
2025-04-27 01:25:12 +09:00
committed by Nico Weber
parent 481deb4bd5
commit 2c28cedf13
2 changed files with 7 additions and 0 deletions

View File

@@ -11,6 +11,11 @@
extern "C" {
intmax_t imaxabs(intmax_t n)
{
return n > 0 ? n : -n;
}
imaxdiv_t imaxdiv(intmax_t numerator, intmax_t denominator)
{
imaxdiv_t result;

View File

@@ -191,6 +191,8 @@ __BEGIN_DECLS
#define SCNxFAST32 SCNx32
#define SCNxFAST64 SCNx64
intmax_t imaxabs(intmax_t);
typedef struct imaxdiv_t {
intmax_t quot;
intmax_t rem;