aboutsummaryrefslogtreecommitdiff
path: root/src/base/math/abs.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/base/math/abs.c')
-rw-r--r--src/base/math/abs.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/base/math/abs.c b/src/base/math/abs.c
new file mode 100644
index 0000000..b758653
--- /dev/null
+++ b/src/base/math/abs.c
@@ -0,0 +1,18 @@
+#include <u.h>
+#include <base.h>
+
+int
+math·abs(int a)
+{
+ if(a < 0)
+ return -a;
+ return a;
+}
+
+long
+math·labs(long a)
+{
+ if(a < 0)
+ return -a;
+ return a;
+}