Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Int Bad, Int32 good. All is well. #12

Closed
wants to merge 1 commit into from

1 participant

@TomMD

Using Int makes me worried that there are or will be portability issues,
given the loose definition Haskell has for Int.

@TomMD TomMD Use an explicit sized int type instead of Int for Serialize instances.
Using Int makes me worried that there are or will be portability issues,
given the loose definition Haskell has for Int.
49750e9
@TomMD

Oops, fired this too fast. I see Int is fixed at Int64 and isn't platform dependent like I thought. Never mind.

@TomMD TomMD closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 18, 2012
  1. @TomMD

    Use an explicit sized int type instead of Int for Serialize instances.

    TomMD authored
    Using Int makes me worried that there are or will be portability issues,
    given the loose definition Haskell has for Int.
This page is out of date. Refresh to see the latest.
Showing with 2 additions and 2 deletions.
  1. +2 −2 src/Data/Serialize.hs
View
4 src/Data/Serialize.hs
@@ -364,9 +364,9 @@ instance (Serialize a, Serialize b) => Serialize (Either a b) where
-- ByteStrings (have specially efficient instances)
instance Serialize B.ByteString where
- put bs = do put (B.length bs :: Int)
+ put bs = do put (fromIntegral (B.length bs) :: Int32)
putByteString bs
- get = get >>= getByteString
+ get = get >>= getByteString . (fromIntegral :: Int32 -> Int)
instance Serialize L.ByteString where
put bs = do put (L.length bs :: Int64)
Something went wrong with that request. Please try again.