[commit: ghc] master: Remove incorrect property in docstring (re #9532) (3241ac5)
git at git.haskell.org
git at git.haskell.org
Mon Sep 1 07:57:17 UTC 2014
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/3241ac56d371220ed0b9522a86678678532f48bc/ghc
>---------------------------------------------------------------
commit 3241ac56d371220ed0b9522a86678678532f48bc
Author: Herbert Valerio Riedel <hvr at gnu.org>
Date: Mon Sep 1 09:50:16 2014 +0200
Remove incorrect property in docstring (re #9532)
The property
countLeadingZeros . negate = const 0
doesn't generally hold and it's not such a useful property to state, as
it simply follows from "sign-bit == most-significant-bit" for FiniteBits
types which use twos-complement representation for negative values, and
even then it breaks down for 0...
TLDR, remove thinko from documentation of `countLeadingZeros`
>---------------------------------------------------------------
3241ac56d371220ed0b9522a86678678532f48bc
libraries/base/Data/Bits.hs | 1 -
1 file changed, 1 deletion(-)
diff --git a/libraries/base/Data/Bits.hs b/libraries/base/Data/Bits.hs
index 532f5d5..cdef2fb 100644
--- a/libraries/base/Data/Bits.hs
+++ b/libraries/base/Data/Bits.hs
@@ -296,7 +296,6 @@ class Bits b => FiniteBits b where
--
-- @
-- 'countLeadingZeros' ('zeroBits' :: a) = finiteBitSize ('zeroBits' :: a)
- -- 'countLeadingZeros' . 'negate' = 'const' 0
-- @
--
-- 'countLeadingZeros' can be used to compute log base 2 via
More information about the ghc-commits
mailing list