libc: Add abs(), labs() and llabs()

Just needed to alias them to GCC builtins.
This commit is contained in:
apio 2022-10-23 11:10:26 +02:00
parent c02f2e128d
commit 51580bb846
2 changed files with 24 additions and 0 deletions

View File

@ -65,6 +65,15 @@ extern "C"
/* Seeds the random number generator with the specified seed. */ /* Seeds the random number generator with the specified seed. */
void srand(unsigned int seed); void srand(unsigned int seed);
/* Returns the absolute value of an integer. */
int abs(int val);
/* Returns the absolute value of an integer. */
long labs(long val);
/* Returns the absolute value of an integer. */
long long llabs(long long val);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@ -63,4 +63,19 @@ extern "C"
syscall(SYS_exit, status); syscall(SYS_exit, status);
__lc_unreachable(); __lc_unreachable();
} }
int abs(int val)
{
return __builtin_abs(val);
}
long labs(long val)
{
return __builtin_labs(val);
}
long long llabs(long long val)
{
return __builtin_llabs(val);
}
} }