[Haskell-cafe] Data.Binary Endianness

Adrian Neumann aneumann at inf.fu-berlin.de
Mon Sep 10 05:24:41 EDT 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160

I try to write a Windows Bitmap File using Data.Binary, but I have some
trouble.

For example, the internet states, that the magic number, that puts 'BM'
in the first two bytes of the file is 19778. But when I

> put (19778::Word16)

I get 'MB' instead. I read on the german Wikipedia, that bmp uses little
endian encoding, but Data.Binary uses big endian. Obviously this can't work.

Is there a way to switch endianness? Or at least a function that
converts between the two?

I looked at the Data.Binary Haddock documentation, but found nothing
like that.

Thanks in advance,

Adrian
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFG5Q1Z11V8mqIQMRsRA/V6AJoC/R2k5rz0LjQI4iGoi79zLYZmgwCdEx/g
cZOR5jseUcQnc6+I09N+xj8=
=K5ww
-----END PGP SIGNATURE-----


More information about the Haskell-Cafe mailing list