stdio-0.1.0.0: A simple and high performance IO toolkit for Haskell

Copyright(c) Dong Han 2017-2018
LicenseBSD
Maintainerwinterland1989@gmail.com
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Std.Data.PrimArray.BitTwiddle

Description

This module implement some bit twiddling with ghc primitives.

We currently didn't use all functions from this module though: the performance is not catching up c version yet. But this module and relevant benchmarks are kept in hope that once we have fully SIMD support in GHC, we might optimize these functions further to compete with c.

Reference:

Synopsis

Documentation

memchr :: PrimArray Word8 -> Word8 -> Int -> Int -> Int Source #

Search a word8 in array.

Currently this function is ~4 times slow than c version, so we didn't use it.

memchr# :: ByteArray# -> Word# -> Int# -> Int# -> Int# Source #

The unboxed version of memchr

memchrReverse :: PrimArray Word8 -> Word8 -> Int -> Int -> Int Source #

Search a word8 array in reverse order.

This function is used in elemIndexEnd, since there's no c equivalent.

memchrReverse# :: ByteArray# -> Word# -> Int# -> Int# -> Int# Source #

The unboxed version of memchrReverse