
#7902: Add support for byte endianness swapping exposed as a primops ---------------------------------+------------------------------------------ Reporter: tab | Owner: Type: feature request | Status: patch Priority: normal | Milestone: Component: Compiler | Version: 7.7 Keywords: bswap endianness | Os: Unknown/Multiple Architecture: Unknown/Multiple | Failure: None/Unknown Difficulty: Unknown | Testcase: Blockedby: | Blocking: Related: | ---------------------------------+------------------------------------------ Changes (by igloo): * difficulty: => Unknown Comment: Attaching patches for GHC here is best, yes. And providing tests too is even better, thanks! I haven't tried them, but these look OK to me, except that I think it would be worth making a helper function to factor out the common code in the LLVM backend, as you suggested. If you'd like to propose exposing the change via the core libraries, then please see http://www.haskell.org/haskellwiki/Library_submissions for details of the process. I'm not sure how best to do it, though: If it goes into `Bits` then you'll need to give an implementation for `Integer`, and in theory could need to give one for a hypothetical `Word13` type. Even `Int` and `Word` aren't guaranteed to be a multiple of 8 bits. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7902#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler