Unicode.Internal.Bits

unicode-data-0.4.0.1: 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 | Safe-Inferred
Language | Haskell2010

Unicode.Internal.Bits

Description

Fast, static bitmap lookup utilities

Synopsis

- lookupBit64 :: Addr# -> Int -> Bool
- lookupIntN :: Addr# -> Int -> Int

# Documentation

lookupBit64 :: Addr# -> Int -> Bool #

`lookup64 addr index` looks up the bit stored at bit index `index` using a bitmap starting at the address `addr`. Looks up the 64-bit word containing the bit and then the bit in that word. The caller must make sure that the 64-bit word at the byte address (addr + index / 64) * 8 is legally accessible memory.

lookupIntN #

Arguments

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

`lookupIntN 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