lib/core: Inlined implementation of `abs`
authorLucas Bajolet <r4pass@hotmail.com>
Tue, 8 Dec 2015 17:10:07 +0000 (12:10 -0500)
committerLucas 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

index 0a07c4b..125e95f 100644 (file)
@@ -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.