nitlanguage
/
nit.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
eedb3e6
)
lib/core: Inlined implementation of `abs`
author
Lucas Bajolet
<r4pass@hotmail.com>
Tue, 8 Dec 2015 17:10:07 +0000
(12:10 -0500)
committer
Lucas Bajolet
<r4pass@hotmail.com>
Tue, 8 Dec 2015 17:10:54 +0000
(12:10 -0500)
Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>
lib/core/kernel.nit
patch
|
blob
|
history
diff --git
a/lib/core/kernel.nit
b/lib/core/kernel.nit
index
0a07c4b
..
125e95f
100644
(file)
--- a/
lib/core/kernel.nit
+++ b/
lib/core/kernel.nit
@@
-890,15
+890,7
@@
universal Int
# assert (-10).abs == 10
# assert 10.abs == 10
# assert 0.abs == 0
- fun abs: Int
- do
- if self >= 0
- then
- return self
- else
- return -1 * self
- end
- end
+ fun abs: Int do return if self >= 0 then self else -self
end
# Native characters.