Add abs function to <stdlib.h>
This commit is contained in:
parent
1697713301
commit
37b3b43b3e
|
@ -12,4 +12,6 @@ void free(void *ptr);
|
||||||
|
|
||||||
_Noreturn void exit(int status);
|
_Noreturn void exit(int status);
|
||||||
|
|
||||||
|
int abs(int j);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -12,3 +12,7 @@ void free(void *ptr) {
|
||||||
_Noreturn void exit(int status) {
|
_Noreturn void exit(int status) {
|
||||||
sys_exit(status);
|
sys_exit(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int abs(int i) {
|
||||||
|
return i > 0 ? i : -i;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue