[GHC] #3041: Arch independent binary representations
GHC
trac at galois.com
Tue Feb 24 16:15:38 EST 2009
#3041: Arch independent binary representations
-----------------------------+----------------------------------------------
Reporter: nomeata | Owner:
Type: feature request | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 6.10.1
Severity: normal | Resolution:
Keywords: | Testcase:
Os: Linux | Architecture: Unknown/Multiple
-----------------------------+----------------------------------------------
Comment (by nomeata):
Just to be clear: If this code in Binary.hs:
{{{
instance Binary Int where
#if SIZEOF_HSINT == 4
put_ bh i = put_ bh (fromIntegral i :: Int32)
get bh = do
x <- get bh
return $! (fromIntegral (x :: Int32))
#elif SIZEOF_HSINT == 8
put_ bh i = put_ bh (fromIntegral i :: Int64)
get bh = do
x <- get bh
return $! (fromIntegral (x :: Int64))
#else
#error "unsupported sizeof(HsInt)"
#endif
-- getF bh = getBitsF bh 32
}}}
could be changed to this code (Int64 or Int32, but choose one)
{{{
instance Binary Int where
put_ bh i = put_ bh (fromIntegral i :: Int32)
get bh = do
x <- get bh
return $! (fromIntegral (x :: Int32))
}}}
then the Binary serialization would be arch-independent again. (At least,
AFAICT)
Is there any reason not to do so?
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3041#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the Glasgow-haskell-bugs
mailing list