unicode-data-0.6.0: Access Unicode Character Database (UCD)

Copyright | (c) 2020 Andrew Lelechenko (c) 2020 Composewell Technologies
License | BSD-3-Clause
Maintainer | streamly@composewell.com
Stability | experimental
Portability | GHC
Safe Haskell | None
Language | Haskell2010

Unicode.Internal.Bits

Contents

- Bitmap lookup
- CString

Description

Fast, static bitmap lookup utilities

Synopsis

- lookupBit :: Addr# -> Int -> Int -> Bool
- lookupWord8AsInt :: Addr# -> Int -> Int
- lookupWord8AsInt# :: Addr# -> Int# -> Int#
- lookupWord16AsInt :: Addr# -> Int -> Int
- lookupWord16AsInt# :: Addr# -> Int# -> Int#
- lookupWord32# :: Addr# -> Int# -> Word#
- unpackCString# :: Addr# -> [Char]

# Bitmap lookup

lookupBit :: Addr# -> Int -> Int -> Bool #

`lookupBit addr byteIndex bitIndex` looks up the bit stored in the byte at index `byteIndex` at the bit index `bitIndex` using a bitmap starting at the address `addr`. The caller must make sure that the byte at address `(addr + byteIndex)` is legally accessible memory.

lookupWord8AsInt #

Arguments

:: Addr# | Bitmap address
-> Int | Word index
-> Int | Resulting word as `Int`

`lookupWord8AsInt addr index` looks up for the `index`-th `8`-bits word in the bitmap starting at `addr`, then convert it to an `Int`.

The caller must make sure that:

- `ceiling (addr + (n * 8))` is legally accessible `Word8#`.

Since: 0.3.0

lookupWord8AsInt# #

Arguments

:: Addr# | Bitmap address
-> Int# | Word index
-> Int# | Resulting word as `Int`

lookupWord16AsInt #

Arguments

:: Addr# | Bitmap address
-> Int | Word index
-> Int | Resulting word as `Int`

lookupWord16AsInt# #

Arguments

:: Addr# | Bitmap address
-> Int# | Word index
-> Int# | Resulting word as `Int`

lookupWord32# #

Arguments

:: Addr# | Bitmap address
-> Int# | Word index
-> Word# | Resulting word

`lookupWord32# addr index` looks up for the `index`-th 32-bits word in the bitmap starting at `addr`, then convert it to a `Word#`.

The caller must make sure that:

- `ceiling (addr + (n * 32))` is legally accessible `Word32#`.

Since: 0.4.1

# CString

unpackCString# :: Addr# -> [Char] #