Speed of simple operations with Ptr Word32s

2004-12-04 Thread Ian Lynagh
Hi all, I was under the impression that simple code like the below, which swaps the endianness of a block of data, ought to be near C speed: -8<--8<--8<--8<- module Main (main) where import Word (Word32) import Foreign.Ptr (Ptr) import Foreign.Marshal.Array (mall

Re: Speed of simple operations with Ptr Word32s

2004-12-04 Thread Wolfgang Thaller
Ian Lynagh wrote: Hi all, I was under the impression that simple code like the below, which swaps the endianness of a block of data, ought to be near C speed: [...] poke p (shiftL x 24 .|. shiftL (x .&. 0xff00) 8 .|. (shiftR x 8 .&. 0xff00)

Re: Speed of simple operations with Ptr Word32s

2004-12-04 Thread Donald Bruce Stewart
wolfgang.thaller: > Ian Lynagh wrote: > >Hi all, > > > >I was under the impression that simple code like the below, which swaps > >the endianness of a block of data, ought to be near C speed: > > > >[...] > > poke p (shiftL x 24 .|. shiftL (x .&. 0xff00) 8 > > .|. (shi