projects
/
ghc-hetmet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
use 'compare' when using the law of trichotomy
[ghc-hetmet.git]
/
compiler
/
utils
/
FastString.lhs
diff --git
a/compiler/utils/FastString.lhs
b/compiler/utils/FastString.lhs
index
4aa10ae
..
637ef0c
100644
(file)
--- a/
compiler/utils/FastString.lhs
+++ b/
compiler/utils/FastString.lhs
@@
-134,12
+134,10
@@
cmpFS (FastString u1 l1 _ buf1 _) (FastString u2 l2 _ buf2 _) =
withForeignPtr buf1 $ \p1 ->
withForeignPtr buf2 $ \p2 -> do
res <- memcmp p1 p2 l
withForeignPtr buf1 $ \p1 ->
withForeignPtr buf2 $ \p2 -> do
res <- memcmp p1 p2 l
- case () of
- _ | res < 0 -> return LT
- | res == 0 -> if l1 == l2 then return EQ
- else if l1 < l2 then return LT
- else return GT
- | otherwise -> return GT
+ return $ case compare res 0 of
+ LT -> LT
+ EQ -> compare l1 l2
+ GT -> GT
#ifndef __HADDOCK__
foreign import ccall unsafe "ghc_memcmp"
#ifndef __HADDOCK__
foreign import ccall unsafe "ghc_memcmp"
@@
-161,6
+159,7
@@
data FastStringTable =
{-# UNPACK #-} !Int
(MutableArray# RealWorld [FastString])
{-# UNPACK #-} !Int
(MutableArray# RealWorld [FastString])
+{-# NOINLINE string_table #-}
string_table :: IORef FastStringTable
string_table =
unsafePerformIO $ do
string_table :: IORef FastStringTable
string_table =
unsafePerformIO $ do