Data.Text.Internal.Unsafe.Shift

text-1.2.3.1: An efficient packed Unicode text type.

Copyright | (c) Bryan O'Sullivan 2009
License | BSD-style
Maintainer | bos@serpentine.com
Stability | experimental
Portability | GHC
Safe Haskell | None
Language | Haskell98

Data.Text.Internal.Unsafe.Shift

Description

Warning: this is an internal module, and does not have a stable API or name. Functions in this module may not check or enforce preconditions expected by public modules. Use at your own risk!

Fast, unchecked bit shifting functions.

Synopsis

- class UnsafeShift a where

# Documentation

class UnsafeShift a where #

This is a workaround for poor optimisation in GHC 6.8.2. It fails to notice constant-width shifts, and adds a test and branch to every shift. This imposes about a 10% performance hit.

These functions are undefined when the amount being shifted by is greater than the size in bits of a machine Int#.

Minimal complete definition

shiftL, shiftR

Methods

shiftL :: a -> Int -> a #

shiftR :: a -> Int -> a #

Instances

UnsafeShift Int # |
Instance details Defined in Data.Text.Internal.Unsafe.Shift Methods shiftL :: Int -> Int -> Int # shiftR :: Int -> Int -> Int #
UnsafeShift Word16 # |
Instance details Defined in Data.Text.Internal.Unsafe.Shift Methods shiftL :: Word16 -> Int -> Word16 # shiftR :: Word16 -> Int -> Word16 #
UnsafeShift Word32 # |
Instance details Defined in Data.Text.Internal.Unsafe.Shift Methods shiftL :: Word32 -> Int -> Word32 # shiftR :: Word32 -> Int -> Word32 #
UnsafeShift Word64 # |
Instance details Defined in Data.Text.Internal.Unsafe.Shift Methods shiftL :: Word64 -> Int -> Word64 # shiftR :: Word64 -> Int -> Word64 #