[GHC] #14818: Provide highestOneBit function in Data.Bits module

GHC ghc-devs at haskell.org
Mon Feb 19 02:27:07 UTC 2018


#14818: Provide highestOneBit function in Data.Bits module
-------------------------------------+-------------------------------------
        Reporter:  kostmo            |                Owner:  (none)
            Type:  feature request   |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  libraries/base    |              Version:  8.2.2
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by bgamari):

 If I understand correctly, we already have these:

  * `countLeadingZeros` is `GHC.Prim.clzN#`, which is exposed by
 `Data.Bits.countLeadingZeros`.
  * `highestOneBit` is `GHC.Prim.ctzN#`, which is exposed by
 `Data.Bits.countTrailingZeros`

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14818#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list