Safe Haskell | None |
---|---|
Language | Haskell2010 |
Documentation
class Select1 v where Source #
Find length of the shortest prefix of the given prefix that contains specified number of occurences of the bit 1
If the bitstring does not have enough occurences of bit 1
is insufficient to satisfy the query the result is undefined.
>>>
import HaskellWorks.Data.Bits.BitRead
>>>
:set -XTypeApplications
>>>
select1 (unsafeBitRead @Word8 "00000000") 0
0>>>
select1 (unsafeBitRead @Word8 "00001000") 1
5>>>
select1 (unsafeBitRead @Word8 "11111111") 4
4>>>
select1 (unsafeBitRead @Word8 "00111111") 4
6>>>
select1 (unsafeBitRead @Word8 "10011111") 4
6
Instances
Select1 Bool Source # | |
Select1 Word8 Source # | |
Select1 Word16 Source # | |
Select1 Word32 Source # | |
Select1 Word64 Source # | |
(PopCount1 w, Select1 w, BitSize w) => Select1 [w] Source # | |
Select1 (Vector Bit) Source # | |
Select1 (Vector Bit) Source # | |
Select1 a => Select1 (BitShown a) Source # | |
Select1 (Vector Word8) Source # | |
Select1 (Vector Word16) Source # | |
Select1 (Vector Word32) Source # | |
Select1 (Vector Word64) Source # | |
Select1 (Vector Word8) Source # | |
Select1 (Vector Word16) Source # | |
Select1 (Vector Word32) Source # | |
Select1 (Vector Word64) Source # | |