Wolfgang Jeltsch pushed to branch wip/jeltsch/portable-bco-byte-array-serialization at Glasgow Haskell Compiler / GHC Commits: 773f0fda by Wolfgang Jeltsch at 2026-11-26T17:28:30+02:00 Switch from boolean to definedness test for `LITTLE_ENDIAN_64_BITS` - - - - - 1 changed file: - libraries/ghci/GHCi/ResolvedBCO.hs Changes: ===================================== libraries/ghci/GHCi/ResolvedBCO.hs ===================================== @@ -20,7 +20,9 @@ module GHCi.ResolvedBCO #error Bytecode serialization works only on 32- and 64-bit platforms. #endif -#define LITTLE_ENDIAN_64_BITS (!defined(WORDS_BIGENDIAN) && SIZEOF_HSWORD == 8) +#if !defined(WORDS_BIGENDIAN) && SIZEOF_HSWORD == 8 +#define LITTLE_ENDIAN_64_BITS +#endif import Prelude -- See note [Why do we import Prelude here?] @@ -41,7 +43,7 @@ import Foreign.Storable (Storable, sizeOf) import GHC.Data.SmallArray (SmallArray) import GHC.Generics (Generic) -#if !LITTLE_ENDIAN_64_BITS +#ifndef LITTLE_ENDIAN_64_BITS import Control.Monad (replicateM) #endif @@ -100,7 +102,7 @@ data BCOByteArray a getBCOByteArray :: !ByteArray# } -#if !LITTLE_ENDIAN_64_BITS +#ifndef LITTLE_ENDIAN_64_BITS fromBCOByteArray :: Storable a => BCOByteArray a -> UArray Int a fromBCOByteArray @a (BCOByteArray ba#) = UArray 0 (n - 1) n ba# @@ -148,7 +150,7 @@ instance Binary ResolvedBCO where 1 -> ResolvedStaticCon <$> get <*> get <*> get <*> get <*> get <*> get _ -> error "Binary ResolvedBCO: invalid byte" -#if !LITTLE_ENDIAN_64_BITS +#ifndef LITTLE_ENDIAN_64_BITS -- | Serialize a 'BCOByteArray', not writing the payload verbatim but -- serializing the individual elements. This can be used with any host @@ -225,7 +227,7 @@ instance Binary (BCOByteArray Word16) where -- See Note [BCOByteArray serialization]. instance Binary (BCOByteArray Word) where -#if LITTLE_ENDIAN_64_BITS +#ifdef LITTLE_ENDIAN_64_BITS put = putBCOByteArrayDirectly get = getBCOByteArrayDirectly #else View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/773f0fdac74241a9f96b5598eb26d76e... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/773f0fdac74241a9f96b5598eb26d76e... You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help