libc: Add abs(), labs() and llabs()
Just needed to alias them to GCC builtins.
This commit is contained in:
parent
c02f2e128d
commit
51580bb846
@ -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
|
||||||
|
@ -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);
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user