Skip to content

Commit

Permalink
Add support for new compareByteArrays# primop
Browse files Browse the repository at this point in the history
  • Loading branch information
hvr committed Jan 18, 2018
1 parent b28ea8d commit e392dfa
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
6 changes: 6 additions & 0 deletions src-ghc804/PrimOps.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{-# LANGUAGE MagicHash #-}
{-# LANGUAGE Unsafe #-}

module PrimOps ( compareByteArrays# ) where

import GHC.Exts (compareByteArrays#)
2 changes: 1 addition & 1 deletion src/Data/Text/Short/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ import qualified PrimOps
-- It can be shown that for realistic data <http://utf8everywhere.org/#asian UTF-16 has a space overhead of 50% over UTF-8>.
--
newtype ShortText = ShortText ShortByteString
deriving (Monoid,Semigroup,Hashable,NFData)
deriving (Monoid,Data.Semigroup.Semigroup,Hashable,NFData)

instance Eq ShortText where
{-# INLINE (==) #-}
Expand Down
8 changes: 6 additions & 2 deletions text-short.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,12 @@ library
if !impl(ghc >= 8.0)
build-depends: semigroups >= 0.18.2 && < 0.19

c-sources: cbits/memcmp.c
hs-source-dirs: src-ghc708
-- GHC version specific PrimOps
if impl(ghc >= 8.4)
hs-source-dirs: src-ghc804
else
c-sources: cbits/memcmp.c
hs-source-dirs: src-ghc708
other-modules: PrimOps

hs-source-dirs: src
Expand Down

0 comments on commit e392dfa

Please sign in to comment.