From: Jean Privat Date: Sun, 29 May 2016 20:35:59 +0000 (-0400) Subject: Merge: catalog: tweak documentation score X-Git-Url: http://nitlanguage.org?hp=bd9979194f0ac741ce170a38d7256e13539651df Merge: catalog: tweak documentation score especially, private things, redefinitions and test_suites count for peanuts. Pull-Request: #2138 Reviewed-by: Alexis Laferrière --- diff --git a/lib/core/math.nit b/lib/core/math.nit index 0f8325f..7b51e2a 100644 --- a/lib/core/math.nit +++ b/lib/core/math.nit @@ -169,6 +169,16 @@ redef class Int end return res end + + # Is `self` a power of two ? + # + # ~~~nit + # assert not 3.is_pow2 + # assert 2.is_pow2 + # assert 1.is_pow2 + # assert not 0.is_pow2 + # ~~~ + fun is_pow2: Bool do return self != 0 and (self & self - 1) == 0 end redef class Byte