This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "snap-server".

The branch, master has been updated
       via  c17e884393b6f13ff3460ea7f7e1ba085b420eef (commit)
      from  df06ce1acdd54db2a63396fd12bfba0cd5344052 (commit)


Summary of changes:
 src/Snap/Internal/Http/Parser.hs |   12 +++++-------
 1 files changed, 5 insertions(+), 7 deletions(-)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit c17e884393b6f13ff3460ea7f7e1ba085b420eef
Author: Leon P Smith <[email protected]>
Date:   Thu Aug 5 23:33:26 2010 -0400

    Simplify toHex, also reducing memory allocation

diff --git a/src/Snap/Internal/Http/Parser.hs b/src/Snap/Internal/Http/Parser.hs
index 4a31e42..1db83f0 100644
--- a/src/Snap/Internal/Http/Parser.hs
+++ b/src/Snap/Internal/Http/Parser.hs
@@ -87,20 +87,18 @@ readChunkedTransferEncoding iter = do
 
 
 ------------------------------------------------------------------------------
-data P = P {-# UNPACK #-} !Int {-# UNPACK #-} !Word64
-
 toHex :: Int64 -> S.ByteString
 toHex 0 = "0"
 toHex n' = s
   where
-    P i n = trim 16 (fromIntegral (abs n'))
-    (!s,_) = S.unfoldrN i f n
-
-    f n = Just (char (n `shiftR` 60), n `shiftL` 4)
+    !s = trim 16 (fromIntegral (abs n'))
 
+    trim :: Int -> Word64 -> S.ByteString
     trim !i !n
       | n .&. 0xf000000000000000 == 0 = trim (i-1) (n `shiftL` 4)
-      | otherwise = P i n
+      | otherwise = fst (S.unfoldrN i f n)
+
+    f n = Just (char (n `shiftR` 60), n `shiftL` 4)
 
     char (fromIntegral -> i)
       | i < 10    = (c2w '0' -  0) + i
-----------------------------------------------------------------------


hooks/post-receive
-- 
snap-server
_______________________________________________
Snap mailing list
[email protected]
http://mailman-mail5.webfaction.com/listinfo/snap

Reply via email to